messageReceived(ctx, (MessageEvent) e); } else if (e instanceof WriteCompletionEvent) { WriteCompletionEvent evt = (WriteCompletionEvent) e; writeComplete(ctx, evt); } else if (e instanceof ChildChannelStateEvent) { ChildChannelStateEvent evt = (ChildChannelStateEvent) e; if (evt.getChildChannel().isOpen()) { childChannelOpen(ctx, evt); } else { childChannelClosed(ctx, evt); case OPEN: if (Boolean.TRUE.equals(evt.getValue())) { channelOpen(ctx, evt); } else { channelClosed(ctx, evt); channelBound(ctx, evt); } else { channelUnbound(ctx, evt); channelConnected(ctx, evt); } else { channelDisconnected(ctx, evt); channelInterestChanged(ctx, evt); break; default:
@Override public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { if (e instanceof ChannelStateEvent) { LOG.info(e.toString()); } super.handleUpstream(ctx, e); }
@Override public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception { outgoingChannel.write(e.getMessage()); super.messageReceived(ctx, e); }
@Override public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { super.channelClosed(ctx, e); //To change body of overridden methods use File | Settings | File Templates. } }
@Override public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { super.channelOpen(ctx, e); }
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { super.channelConnected(ctx, e); //To change body of overridden methods use File | Settings | File Templates. }
/** * @see org.jboss.netty.channel.SimpleChannelUpstreamHandler#channelDisconnected(org.jboss.netty.channel.ChannelHandlerContext, * org.jboss.netty.channel.ChannelStateEvent) */ @Override public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { LOG.info("Receive channelDisconnected to {}, channel = {}", client.getRemoteAddr(), e.getChannel()); // ctx.sendUpstream(e); super.channelDisconnected(ctx, e); client.disconnectChannel(e.getChannel()); }
@Override public void messageReceived(final ChannelHandlerContext ctx, MessageEvent messageEvent) throws Exception { if (messageEvent.getMessage() instanceof HttpRequest && ctx.getAttachment() != IGNORE_REQUEST) { handleHttpRequest(ctx, messageEvent, (HttpRequest) messageEvent.getMessage()); } else { super.messageReceived(ctx, messageEvent); } }
@Override public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { // Clean-up the previous decoder if not cleaned up correctly. finishDecode(); super.channelClosed(ctx, e); }
@Override public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { // channel = e.getChannel(); super.channelOpen(ctx, e); }
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { NettyTCPClient.ALL_CHANNELS.add(e.getChannel()); super.channelConnected(ctx, e); }
@Override public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { super.channelDisconnected(ctx, e); LOG.info("Connection channelDisconnected {}", e.getChannel().getRemoteAddress()); MessageDecoder.removeTransmitHistogram(e.getChannel()); server.getChannelGroup().remove(e.getChannel()); }
@Override public void messageReceived(final ChannelHandlerContext ctx, MessageEvent e) throws Exception { // call super to reset the read timeout super.messageReceived(ctx, e); Channel channel = ctx.getChannel(); Object attribute = Channels.getAttribute(channel); if (attribute instanceof Callback) { Object message = e.getMessage(); Callback ac = (Callback) attribute; if (message instanceof HttpChunk) { // the AsyncCallable is to be processed on the last chunk if (HttpChunk.class.cast(message).isLast()) // process the AsyncCallable before passing the message to the protocol ac.call(); // FIXME remove attribute? } else { LOGGER.info("Received unexpected message while expecting a chunk: " + message); ac.call(); Channels.setDiscard(channel); } } else if (attribute instanceof NettyResponseFuture<?>) { NettyResponseFuture<?> future = (NettyResponseFuture<?>) attribute; protocol.handle(channel, future, e.getMessage()); } else if (attribute != DiscardEvent.INSTANCE) { // unhandled message LOGGER.debug("Orphan channel {} with attribute {} received message {}, closing", channel, attribute, e.getMessage()); Channels.silentlyCloseChannel(channel); } }
@Override public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { LOG.info("Connection to {} has been closed, channel = {}", client.getRemoteAddr(), e.getChannel()); super.channelClosed(ctx, e); }
@Override public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { super.channelOpen(ctx, e); joinStatus.setCurrentActivity("Authenticating with server"); }
@Override public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { if (e instanceof IdleStateEvent) { channelIdle(ctx, (IdleStateEvent) e); } else { super.handleUpstream(ctx, e); } }
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { super.channelConnected(ctx, e); }
@Override public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { node = null; super.channelDisconnected(ctx, e); }
super.messageReceived(ctx, e);
@Override public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { super.channelClosed(ctx, e); LOG.info("Connection channelClosed {}", e.getChannel().getRemoteAddress()); MessageDecoder.removeTransmitHistogram(e.getChannel()); }