public ByteBuf getNextByteBuf() throws InterruptedException {
    ByteBuf chunkBuf = null;
    if (isOpen()) {
      chunkBuf = getChunkBuf(chunks.take());
    }
    return chunkBuf;
  }
Gets the next chunk of data as a {@link ByteBuf} when it is available.
<p/>
If the channel is not closed, this function blocks until the next chunk is available. Once the channel is closed,
this function starts returning {@code null}.
@return a {@link ByteBuf} representing the next chunk of data if the channel is not closed. {@code null} if the
        channel is closed.
@throws InterruptedException if the wait for a chunk is interrupted.
ambry-commons/src/main/java/com/github/ambry/commons/ByteBufferAsyncWritableChannel.java