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


Java ChannelGroupFutureListener类代码示例

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


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

示例1: sendServerClosedPacket

import org.jboss.netty.channel.group.ChannelGroupFutureListener; //导入依赖的package包/类
private void sendServerClosedPacket() {
    logger.info("sendServerClosedPacket start");
    final ChannelGroupFuture write = this.channelGroup.write(new ServerClosePacket());
    write.awaitUninterruptibly(5000, TimeUnit.MILLISECONDS);
    if (logger.isWarnEnabled()) {
        write.addListener(new ChannelGroupFutureListener() {
            private final ChannelFutureListener listener = new WriteFailFutureListener(logger, "serverClosePacket write fail", "serverClosePacket write success");

            @Override
            public void operationComplete(ChannelGroupFuture future) throws Exception {
                for (ChannelFuture channelFuture : future) {
                    channelFuture.addListener(listener);
                }
            }
        });
    }
    logger.info("sendServerClosedPacket end");
}
 
开发者ID:masonmei,项目名称:apm-agent,代码行数:19,代码来源:PinpointServerSocket.java

示例2: sendPing

import org.jboss.netty.channel.group.ChannelGroupFutureListener; //导入依赖的package包/类
private void sendPing() {
    logger.debug("sendPing");
    final TimerTask pintTask = new TimerTask() {
        @Override
        public void run(Timeout timeout) throws Exception {
            if (timeout.isCancelled()) {
                newPingTimeout(this);
                return;
            }

            final ChannelGroupFuture write = channelGroup.write(PingPacket.PING_PACKET);
            if (logger.isWarnEnabled()) {
                write.addListener(new ChannelGroupFutureListener() {
                    private final ChannelFutureListener listener = new WriteFailFutureListener(logger, "ping write fail", "ping write success");

                    @Override
                    public void operationComplete(ChannelGroupFuture future) throws Exception {

                        if (logger.isWarnEnabled()) {
                            for (ChannelFuture channelFuture : future) {
                                channelFuture.addListener(listener);
                            }
                        }
                    }
                });
            }
            newPingTimeout(this);
        }
    };
    newPingTimeout(pintTask);
}
 
开发者ID:masonmei,项目名称:apm-agent,代码行数:32,代码来源:PinpointServerSocket.java

示例3: closeChannels

import org.jboss.netty.channel.group.ChannelGroupFutureListener; //导入依赖的package包/类
public void closeChannels() {
    LOGGER.info("Closing {} open channels.", size());
    channels.close().addListener(new ChannelGroupFutureListener() {
        @Override
        public void operationComplete(ChannelGroupFuture future) {
            LOGGER.info("Closed all channels.");
        }
    });
}
 
开发者ID:RIPE-NCC,项目名称:whois,代码行数:10,代码来源:NrtmChannelsRegistry.java


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