当前位置: 首页>>代码示例>>Java>>正文


Java ChannelProgressivePromise类代码示例

本文整理汇总了Java中io.netty.channel.ChannelProgressivePromise的典型用法代码示例。如果您正苦于以下问题:Java ChannelProgressivePromise类的具体用法?Java ChannelProgressivePromise怎么用?Java ChannelProgressivePromise使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ChannelProgressivePromise类属于io.netty.channel包,在下文中一共展示了ChannelProgressivePromise类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeRequest

import io.netty.channel.ChannelProgressivePromise; //导入依赖的package包/类
public <T> void writeRequest(NettyResponseFuture<T> future, Channel channel) {

        NettyRequest nettyRequest = future.getNettyRequest();
        HttpRequest httpRequest = nettyRequest.getHttpRequest();
        AsyncHandler<T> handler = future.getAsyncHandler();

        // if the channel is dead because it was pooled and the remote
        // server decided to close it,
        // we just let it go and the channelInactive do its work
        if (!Channels.isChannelValid(channel))
            return;

        try {
            if (handler instanceof TransferCompletionHandler)
                configureTransferAdapter(handler, httpRequest);

            boolean writeBody = !future.isDontWriteBodyBecauseExpectContinue() && httpRequest.getMethod() != HttpMethod.CONNECT && nettyRequest.getBody() != null;

            if (!future.isHeadersAlreadyWrittenOnContinue()) {
                if (future.getAsyncHandler() instanceof AsyncHandlerExtensions)
                    AsyncHandlerExtensions.class.cast(future.getAsyncHandler()).onRequestSend(nettyRequest);

                ChannelProgressivePromise promise = channel.newProgressivePromise();
                ChannelFuture f = writeBody ? channel.write(httpRequest, promise) : channel.writeAndFlush(httpRequest, promise);
                f.addListener(new ProgressListener(future.getAsyncHandler(), future, true, 0L));
            }

            if (writeBody)
                nettyRequest.getBody().write(channel, future);

            // don't bother scheduling read timeout if channel became invalid
            if (Channels.isChannelValid(channel))
                scheduleReadTimeout(future);

        } catch (Exception e) {
            LOGGER.error("Can't write request", e);
            abort(channel, future, e);
        }
    }
 
开发者ID:amaralDaniel,项目名称:megaphone,代码行数:40,代码来源:NettyRequestSender.java

示例2: success

import io.netty.channel.ChannelProgressivePromise; //导入依赖的package包/类
void success() {
    if (promise.isDone()) {
        // No need to notify the progress or fulfill the promise because it's done already.
        return;
    }

    if (promise instanceof ChannelProgressivePromise) {
        // Now we know what the total is.
        ((ChannelProgressivePromise) promise).tryProgress(progress, progress);
    }

    promise.trySuccess();
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:14,代码来源:ChunkedWriteHandler.java

示例3: success

import io.netty.channel.ChannelProgressivePromise; //导入依赖的package包/类
void success() {
    if (promise instanceof ChannelProgressivePromise) {
        // Now we know what the total is.
        ((ChannelProgressivePromise) promise).tryProgress(progress, progress);
    }
    promise.setSuccess();
}
 
开发者ID:kyle-liu,项目名称:netty4study,代码行数:8,代码来源:ChunkedWriteHandler.java

示例4: newProgressivePromise

import io.netty.channel.ChannelProgressivePromise; //导入依赖的package包/类
@Override
public ChannelProgressivePromise newProgressivePromise() {
    return null;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:Netty4HttpChannelTests.java

示例5: newProgressivePromise

import io.netty.channel.ChannelProgressivePromise; //导入依赖的package包/类
@Override
public ChannelProgressivePromise newProgressivePromise() {
	// TODO Auto-generated method stub
	return null;
}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:6,代码来源:InvocationChannel.java

示例6: newProgressivePromise

import io.netty.channel.ChannelProgressivePromise; //导入依赖的package包/类
@Override
public ChannelProgressivePromise newProgressivePromise() {
	return ctx.newProgressivePromise();
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:5,代码来源:ContextWrapper.java

示例7: progress

import io.netty.channel.ChannelProgressivePromise; //导入依赖的package包/类
void progress(int amount) {
    progress += amount;
    if (promise instanceof ChannelProgressivePromise) {
        ((ChannelProgressivePromise) promise).tryProgress(progress, -1);
    }
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:7,代码来源:ChunkedWriteHandler.java

示例8: newProgressivePromise

import io.netty.channel.ChannelProgressivePromise; //导入依赖的package包/类
@Override
public ChannelProgressivePromise newProgressivePromise() {

    return null;
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:6,代码来源:ChannelHandlerContextAdapter.java

示例9: newProgressivePromise

import io.netty.channel.ChannelProgressivePromise; //导入依赖的package包/类
@Override
public ChannelProgressivePromise newProgressivePromise() {
    return new DefaultChannelProgressivePromise(channel);
}
 
开发者ID:Netflix,项目名称:karyon,代码行数:5,代码来源:MockChannelHandlerContext.java


注:本文中的io.netty.channel.ChannelProgressivePromise类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。