@Override public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { // Clean-up the previous encoder if not cleaned up correctly. finishEncode(); super.channelClosed(ctx, e); }
/** * Fail all buffered writes that are left. See * <a href="https://github.com/netty/netty/issues/308>#308</a> for more details. */ @Override public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { Throwable cause = null; for (;;) { MessageEvent ev = queue.poll(); if (ev == null) { break; } if (cause == null) { cause = new ClosedChannelException(); } ev.getFuture().setFailure(cause); } if (cause != null) { Channels.fireExceptionCaught(ctx.getChannel(), cause); } super.channelClosed(ctx, e); }
channelOpen(ctx, evt); } else { channelClosed(ctx, evt);
@Override public void channelClosed(final ChannelHandlerContext ctx, final ChannelStateEvent e) throws Exception { if (task != null) { task.close(); } super.channelClosed(ctx, e); }
@Override public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { if (DEBUG) { log.info("Channel closed: " + e.getChannel()); } super.channelClosed(ctx, e); }
@Override public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { super.channelClosed(ctx, e); logger.debug("{} {} -> sent: {}b, recv: {}b", new Object[]{id, ctx.getChannel(), writtenMessages, readMessages}); }
@Override public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { super.channelClosed(ctx, e); System.out.println(this.id + ctx.getChannel() + " -> sent: " + this.getWrittenMessages() + ", recv: " + this.getReadMessages()); }
@Override public synchronized void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { if (state == State.OPEN && !serverHasInitiatedClose.get()) { logger.debug("Session " + id + " underlying channel closed unexpectedly. Flagging session as interrupted." + e.getChannel()); setState(State.INTERRUPTED); } else { logger.debug("Session " + id + " underlying channel closed " + e.getChannel()); } // FIXME: Stop any heartbeat // FIXME: Timer to expire the connection? Should not close session here. // FIXME: Notify the sessionCallback? Unless timeout etc, disconnect it? unsetChannel(e.getChannel()); super.channelClosed(ctx, e); }
@Override public void channelClosed( ChannelHandlerContext ctx, ChannelStateEvent e ) throws Exception { super.channelClosed( ctx, e ); if ( !ctx.getChannel().isOpen() ) { tryToCloseChannel( ctx.getChannel() ); } channelGroup.remove( e.getChannel() ); }