类io.netty.channel.ChannelProgressiveFuture源码实例Demo

下面列出了怎么用io.netty.channel.ChannelProgressiveFuture的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: blade   文件: ProgressiveFutureListener.java
@Override
public void operationProgressed(ChannelProgressiveFuture future, long progress, long total) {
    if (total < 0) { // total unknown
        log.debug("{} Transfer progress: {}", future.channel(), progress);
    } else {
        log.debug("{} Transfer progress: {}/{}", future.channel(), progress, total);
    }
}
 
源代码2 项目: blade   文件: ProgressiveFutureListener.java
@Override
public void operationComplete(ChannelProgressiveFuture future) {
    try {
        raf.close();
        log.debug("{} Transfer complete.", future.channel());
    } catch (Exception e) {
        log.error("RandomAccessFile close error", e);
    }
}
 
源代码3 项目: ambry   文件: NettyResponseChannel.java
/**
 * Called once the write is complete i.e. either all chunks that were needed to be written were written or there
 * was an error  writing the chunks.
 * @param future the {@link ChannelProgressiveFuture} that is being listened on.
 */
@Override
public void operationComplete(ChannelProgressiveFuture future) {
  if (future.isSuccess()) {
    logger.trace("Response sending complete on channel {}", ctx.channel());
    completeRequest(request == null || !request.isKeepAlive(), false);
  } else {
    handleChannelWriteFailure(future.cause(), true);
  }
}
 
源代码4 项目: ambry   文件: NettyResponseChannel.java
/**
 * Uses {@code progress} to determine chunks whose callbacks need to be invoked.
 * @param future the {@link ChannelProgressiveFuture} that is being listened on.
 * @param progress the total number of bytes that have been written starting from the time writes were invoked via
 *                 {@link ChunkedWriteHandler}.
 * @param total the total number of bytes that need to be written i.e. the target number. This is not relevant to
 *              {@link ChunkedWriteHandler} because there is no target number. All calls to this function except
 *              the very last one will have a negative {@code total}.
 */
@Override
public void operationProgressed(ChannelProgressiveFuture future, long progress, long total) {
  logger.trace("{} bytes of response written on channel {}", progress, ctx.channel());
  while (chunksAwaitingCallback.peek() != null
      && progress >= chunksAwaitingCallback.peek().writeCompleteThreshold) {
    chunksAwaitingCallback.poll().resolveChunk(null);
  }
}
 
 类所在包
 同包方法