@Override public void caught(Channel channel, Throwable exception) throws RemotingException { handler.caught(channel, exception); } }
@Override public void connected(Channel ch) throws RemotingException { if (closed) { return; } handler.connected(ch); }
@Override public void disconnected(Channel ch) throws RemotingException { handler.disconnected(ch); }
if (state == ChannelState.RECEIVED) { try { handler.received(channel, message); } catch (Exception e) { logger.warn("ChannelEventRunnable handle " + state + " operation error, channel is " + channel case CONNECTED: try { handler.connected(channel); } catch (Exception e) { logger.warn("ChannelEventRunnable handle " + state + " operation error, channel is " + channel, e); case DISCONNECTED: try { handler.disconnected(channel); } catch (Exception e) { logger.warn("ChannelEventRunnable handle " + state + " operation error, channel is " + channel, e); case SENT: try { handler.sent(channel, message); } catch (Exception e) { logger.warn("ChannelEventRunnable handle " + state + " operation error, channel is " + channel case CAUGHT: try { handler.caught(channel, exception); } catch (Exception e) { logger.warn("ChannelEventRunnable handle " + state + " operation error, channel is " + channel
@Override public void received(Channel ch, Object msg) throws RemotingException { if (closed) { return; } handler.received(ch, msg); }
@Override public void sent(Channel ch, Object msg) throws RemotingException { if (closed) { return; } handler.sent(ch, msg); }
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { super.write(ctx, msg, promise); final NettyChannel channel = NettyChannel.getOrAddChannel(ctx.channel(), url, handler); final boolean isRequest = msg instanceof Request; // We add listeners to make sure our out bound event is correct. // If our out bound event has an error (in most cases the encoder fails), // we need to have the request return directly instead of blocking the invoke process. promise.addListener(future -> { try { if (future.isSuccess()) { // if our future is success, mark the future to sent. handler.sent(channel, msg); return; } Throwable t = future.cause(); if (t != null && isRequest) { Request request = (Request) msg; Response response = buildErrorResponse(request, t); handler.received(channel, response); } } finally { NettyChannel.removeChannelIfDisconnected(ctx.channel()); } }); }
if (state == ChannelState.RECEIVED) { try { handler.received(channel, message); } catch (Exception e) { logger.warn("ChannelEventRunnable handle " + state + " operation error, channel is " + channel case CONNECTED: try { handler.connected(channel); } catch (Exception e) { logger.warn("ChannelEventRunnable handle " + state + " operation error, channel is " + channel, e); case DISCONNECTED: try { handler.disconnected(channel); } catch (Exception e) { logger.warn("ChannelEventRunnable handle " + state + " operation error, channel is " + channel, e); case SENT: try { handler.sent(channel, message); } catch (Exception e) { logger.warn("ChannelEventRunnable handle " + state + " operation error, channel is " + channel case CAUGHT: try { handler.caught(channel, exception); } catch (Exception e) { logger.warn("ChannelEventRunnable handle " + state + " operation error, channel is " + channel
@Override public void received(Channel ch, Object msg) throws RemotingException { if (closed) { return; } handler.received(ch, msg); }
@Override public void sent(Channel ch, Object msg) throws RemotingException { if (closed) { return; } handler.sent(ch, msg); }
@Override public void connected(Channel ch) throws RemotingException { if (closed) { return; } handler.connected(ch); }
@Override public void caught(Channel ch, Throwable ex) throws RemotingException { handler.caught(ch, ex); } }
@SuppressWarnings("unchecked") @Override public void received(Channel channel, Object message) throws RemotingException { if (message instanceof MultiMessage) { MultiMessage list = (MultiMessage) message; for (Object obj : list) { handler.received(channel, obj); } } else { handler.received(channel, message); } } }
@Override public void disconnected(Channel channel) throws RemotingException { handler.disconnected(channel); }
@Override public void sent(Channel channel, Object message) throws RemotingException { handler.sent(channel, message); }
@Override public void connected(Channel channel) throws RemotingException { handler.connected(channel); }
@Override public void caught(Channel channel, Throwable exception) throws RemotingException { handler.caught(channel, exception); } }
@Override public void received(Channel channel, Object message) throws RemotingException { handler.received(channel, message); }
@Override public void disconnected(Channel channel) throws RemotingException { handler.disconnected(channel); }
@Override public void sent(Channel channel, Object message) throws RemotingException { handler.sent(channel, message); }