use of org.apache.flink.shaded.netty4.io.netty.util.concurrent.Future in project spring-boot-protocol by wangzihaogithub.
the class NettyHttp2ClientPool method close.
@Override
public void close() {
for (List<NettyHttp2Client> clients : values()) {
for (NettyHttp2Client client : clients) {
client.close().addListener(new GenericFutureListener<Future<? super Long>>() {
@Override
public void operationComplete(Future<? super Long> future) throws Exception {
LoggerFactoryX.getLogger(NettyHttp2ClientPool.class).info("http2 client close = {}", client.getRemoteAddress());
}
});
}
}
clear();
EventLoopGroup worker = this.worker;
if (worker != null && !worker.isShutdown()) {
worker.shutdownGracefully();
}
}
use of org.apache.flink.shaded.netty4.io.netty.util.concurrent.Future in project SMSGate by Lihuanghe.
the class SMPPSessionLoginManager method failedLogin.
@Override
protected void failedLogin(ChannelHandlerContext ctx, Object msg, long status) {
if (msg instanceof BaseBind) {
logger.error("Connected error status :{},msg : {}", status, msg);
BaseBind message = (BaseBind) msg;
// 认证失败
PduResponse resp = message.createResponse();
resp.setCommandStatus((int) SmppConstants.STATUS_BINDFAIL);
ChannelFuture promise = ctx.writeAndFlush(resp);
final ChannelHandlerContext finalctx = ctx;
promise.addListener(new GenericFutureListener() {
public void operationComplete(Future future) throws Exception {
finalctx.close();
}
});
} else {
logger.error("connect msg type error : {}", msg);
ctx.close();
}
}
use of org.apache.flink.shaded.netty4.io.netty.util.concurrent.Future in project SMSGate by Lihuanghe.
the class SgipUnbindRequestMessageHandler method channelRead0.
@Override
protected void channelRead0(final ChannelHandlerContext ctx, SgipUnbindRequestMessage msg) throws Exception {
SgipUnbindResponseMessage resp = new SgipUnbindResponseMessage(msg.getHeader());
ChannelFuture future = ctx.channel().writeAndFlush(resp);
final ChannelHandlerContext finalctx = ctx;
future.addListeners(new GenericFutureListener() {
@Override
public void operationComplete(Future future) throws Exception {
ctx.executor().schedule(new Runnable() {
@Override
public void run() {
finalctx.channel().close();
}
}, 500, TimeUnit.MILLISECONDS);
}
});
}
use of org.apache.flink.shaded.netty4.io.netty.util.concurrent.Future in project SMSGate by Lihuanghe.
the class UnbindMessageHandler method channelRead0.
@Override
protected void channelRead0(final ChannelHandlerContext ctx, Unbind msg) throws Exception {
UnbindResp resp = msg.createResponse();
ChannelFuture future = ctx.channel().writeAndFlush(resp);
final ChannelHandlerContext finalctx = ctx;
future.addListeners(new GenericFutureListener() {
@Override
public void operationComplete(Future future) throws Exception {
ctx.executor().schedule(new Runnable() {
@Override
public void run() {
finalctx.channel().close();
}
}, 500, TimeUnit.MILLISECONDS);
}
});
}
use of org.apache.flink.shaded.netty4.io.netty.util.concurrent.Future in project WindSpigot by Wind-Development.
the class PlayerConnection method disconnect.
// No called of force closed
public void disconnect(String s) {
// CraftBukkit start - fire PlayerKickEvent
String leaveMessage = EnumChatFormat.YELLOW + this.player.getName() + " left the game.";
PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage);
if (this.server.getServer().isRunning()) {
this.server.getPluginManager().callEvent(event);
}
if (event.isCancelled()) {
// Do not kick the player
return;
}
// Send the possibly modified leave message
s = event.getReason();
// CraftBukkit end
final ChatComponentText chatcomponenttext = new ChatComponentText(s);
this.networkManager.a(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener() {
@Override
public void operationComplete(Future future) throws Exception {
// CraftBukkit - fix decompile error
PlayerConnection.this.networkManager.close(chatcomponenttext);
}
}, new GenericFutureListener[0]);
// CraftBukkit - fire quit instantly
this.a(chatcomponenttext);
this.networkManager.k();
// CraftBukkit - Don't wait
this.minecraftServer.postToMainThread(new Runnable() {
@Override
public void run() {
PlayerConnection.this.networkManager.l();
}
});
}
Aggregations