@Override
  public void close() {
    open = false;
    synchronized (bufferLock) {
      if (compositeBuffer != null) {
        compositeBuffer.release();
        compositeBuffer = null;
      }
    }
  }
Internal method for writing to the channel that allows for a pluggable action to be taken to produce a
retained {@link ByteBuf} that can be added to the composite buffer.
@param retainedBufSupplier creates a retained {@link ByteBuf} that can be freely added to a
                           {@link CompositeByteBuf}.
@param callback called once the buffer has been added.
@return a future that is completed once the buffer has been added.
ambry-commons/src/main/java/com/github/ambry/commons/RetainingAsyncWritableChannel.java