void resolveChunk(Exception exception) {
      long chunkWriteFinishTime = System.currentTimeMillis();
      long bytesWritten = 0;
      if (exception == null) {
        bytesWritten = bytesToBeWritten;
        buffer.skipBytes((int) bytesWritten);
      }
      nettyMetrics.bytesWriteRate.mark(bytesWritten);
      future.done(bytesWritten, exception);
      if (callback != null) {
        callback.onCompletion(bytesWritten, exception);
      }
      long chunkResolutionProcessingTime = System.currentTimeMillis() - chunkWriteFinishTime;
      long chunkWriteTime = chunkWriteFinishTime - chunkWriteStartTime;
      nettyMetrics.channelWriteTimeInMs.update(chunkWriteTime);
      nettyMetrics.chunkResolutionProcessingTimeInMs.update(chunkResolutionProcessingTime);
      if (request != null) {
        request.getMetricsTracker().nioMetricsTracker.addToResponseProcessingTime(
            chunkWriteTime + chunkResolutionProcessingTime);
      }
    }
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-rest/src/main/java/com/github/ambry/rest/NettyResponseChannel.java