private void resolveChunk(Exception exception) {
      if (buf != null) {
        long bytesWritten = buf.readerIndex() - startPos;
        future.done(bytesWritten, exception);
        if (callback != null) {
          callback.onCompletion(bytesWritten, exception);
        }
      }
    }
Marks a chunk as handled and invokes the callback and future that accompanied this chunk of data. Once a chunk is
resolved, the data inside it is considered void.
@param exception the reason for chunk handling failure.
ambry-commons/src/main/java/com/github/ambry/commons/ByteBufferAsyncWritableChannel.java