@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); }
static void removeChannelIfDisconnected(Channel ch) { if (ch != null && !ch.isConnected()) { ch.removeAttribute(CHANNEL_KEY); } }
@Override public void send(Object message, boolean sent) throws RemotingException { if (needReconnect && !isConnected()) { connect(); } Channel channel = getChannel(); //TODO Can the value returned by getChannel() be null? need improvement. if (channel == null || !channel.isConnected()) { throw new RemotingException(this, "message can not send, because channel is closed . url:" + getUrl()); } channel.send(message, sent); }
@Override public void sent(Channel ch, Object msg) throws RemotingException { if (closed) { return; } handler.sent(ch, msg); }
private boolean isInvokedSelectCommand(Channel channel) { if (channel.hasAttribute(SelectTelnetHandler.SELECT_KEY)) { channel.removeAttribute(SelectTelnetHandler.SELECT_KEY); return true; } return false; } }
@Override public void received(Channel ch, Object msg) throws RemotingException { if (closed) { return; } handler.received(ch, msg); }
@Override public String telnet(Channel channel, String message) { channel.close(); return null; }
@Override public void send(Object message, boolean sent) throws RemotingException { channel.send(message, sent); } }
@Override public void reset(URL url) { client.reset(url); // FIXME, should cancel and restart timer tasks if parameters in the new URL are different? }
@Override public boolean isClosed() { return server.isClosed(); } }
@Override public void caught(Channel ch, Throwable ex) throws RemotingException { handler.caught(ch, ex); } }
static void removeChannelIfDisconnected(Channel ch) { if (ch != null && !ch.isConnected()) { ch.removeAttribute(CHANNEL_KEY); } }
@Override public void sent(Channel ch, Object msg) throws RemotingException { if (closed) { return; } handler.sent(ch, msg); }
private boolean isInvokedSelectCommand(Channel channel) { if (channel.hasAttribute(SelectTelnetHandler.SELECT_KEY)) { channel.removeAttribute(SelectTelnetHandler.SELECT_KEY); return true; } return false; } }
@Override public void send(Object message, boolean sent) throws RemotingException { channel.send(message, sent); } }
@Override public void reset(URL url) { client.reset(url); // FIXME, should cancel and restart timer tasks if parameters in the new URL are different? }
@Override public boolean isClosed() { return server.isClosed(); } }
@Override public void caught(Channel channel, Throwable exception) throws RemotingException { handler.caught(channel, exception); } }
@Override public void caught(Channel ch, Throwable ex) throws RemotingException { handler.caught(ch, ex); } }