本文整理汇总了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");
}
示例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);
}
示例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.");
}
});
}