class SharedWritePipe implements WritePipe<T> {

  @Override
  public void close() {
    if (remainingClosesRequired.decrementAndGet() == 0) {
      delegate.close();
    }
  }

  public  SharedWritePipe(final WritePipe<T> delegate, final int closesRequired);

}