@Override public void run() { listener.connectionDestroyed(connectionID); } });
@Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { synchronized (this) { if (active) { listenerExecutor.execute(() -> listener.connectionDestroyed(channelId(ctx.channel()))); active = false; } } super.channelInactive(ctx); }
@Override public synchronized void close() { if (channelClazz == null) { return; } if (batchFlusherFuture != null) { batchFlusherFuture.cancel(false); flusher.cancel(); flusher = null; batchFlusherFuture = null; } bootstrap = null; channelGroup.close().awaitUninterruptibly(); // Shutdown the EventLoopGroup if no new task was added for 100ms or if // 3000ms elapsed. group.shutdownGracefully(100, 3000, TimeUnit.MILLISECONDS); channelClazz = null; for (Connection connection : connections.values()) { listener.connectionDestroyed(connection.getID()); } connections.clear(); }
@Override public final void close() { if (closed) { return; } EventLoop eventLoop = channel.eventLoop(); boolean inEventLoop = eventLoop.inEventLoop(); //if we are in an event loop we need to close the channel after the writes have finished if (!inEventLoop) { closeChannel(channel, false); } else { eventLoop.execute(() -> { closeChannel(channel, true); }); } closed = true; listener.connectionDestroyed(getID()); }
@Override public void run() { listener.connectionDestroyed(connectionID); } });
@Override public void run() { listener.connectionDestroyed(connectionID); } });
@Override public void run() { listener.connectionDestroyed(connectionID); } });
@Override public void run() { listener.connectionDestroyed(connectionID); } });
@Override public void run() { listener.connectionDestroyed(connectionID); } });
@Override public void run() { listener.connectionDestroyed(connectionID); } });
@Override public void run() { listener.connectionDestroyed(connectionID); } });
@Override public void close() { if (closing) { return; } closing = true; synchronized (this) { if (!closed) { listener.connectionDestroyed(id); closed = true; } } }
@Override public synchronized void close() { if (!started) { return; } for (Connection connection : connections.values()) { listener.connectionDestroyed(connection.getID()); } started = false; }
@Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { synchronized (this) { if (active) { listenerExecutor.execute(() -> listener.connectionDestroyed(channelId(ctx.channel()))); active = false; } } super.channelInactive(ctx); }
@Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { synchronized (this) { if (active) { listenerExecutor.execute(() -> listener.connectionDestroyed(channelId(ctx.channel()))); active = false; } } super.channelInactive(ctx); }
@Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { synchronized (this) { if (active) { listenerExecutor.execute(() -> listener.connectionDestroyed(channelId(ctx.channel()))); active = false; } } super.channelInactive(ctx); }
@Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { synchronized (this) { if (active) { listenerExecutor.execute(() -> listener.connectionDestroyed(channelId(ctx.channel()))); active = false; } } super.channelInactive(ctx); }
@Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { synchronized (this) { if (active) { listenerExecutor.execute(() -> listener.connectionDestroyed(channelId(ctx.channel()))); active = false; } } super.channelInactive(ctx); }
@Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { synchronized (this) { if (active) { listenerExecutor.execute(() -> listener.connectionDestroyed(channelId(ctx.channel()))); active = false; } } super.channelInactive(ctx); }
@Override public final void close() { if (closed) { return; } EventLoop eventLoop = channel.eventLoop(); boolean inEventLoop = eventLoop.inEventLoop(); //if we are in an event loop we need to close the channel after the writes have finished if (!inEventLoop) { closeChannel(channel, false); } else { eventLoop.execute(() -> { closeChannel(channel, true); }); } closed = true; listener.connectionDestroyed(getID()); }