@Override public Object getAttribute(String key) { return channel.getAttribute(key); }
@Override public Object getAttribute(String key) { return channel.getAttribute(key); }
@Override public Object getAttribute(String key) { return channel.getAttribute(key); }
@Override public Object getAttribute(String key) { return channel.getAttribute(key); }
@Override public Object getAttribute(String key) { return channel.getAttribute(key); }
@Override public Object getAttribute(String key) { return channel.getAttribute(key); }
static Long lastRead(Channel channel) { return (Long) channel.getAttribute(HeaderExchangeHandler.KEY_READ_TIMESTAMP); }
static Long lastRead(Channel channel) { return (Long) channel.getAttribute(HeaderExchangeHandler.KEY_READ_TIMESTAMP); }
static Long lastWrite(Channel channel) { return (Long) channel.getAttribute(HeaderExchangeHandler.KEY_WRITE_TIMESTAMP); }
@Override public String telnet(Channel channel, String message) { if (message.length() > 0) { return "Unsupported parameter " + message + " for pwd."; } String service = (String) channel.getAttribute(ChangeTelnetHandler.SERVICE_KEY); StringBuilder buf = new StringBuilder(); if (service == null || service.length() == 0) { buf.append("/"); } else { buf.append(service); } return buf.toString(); }
@Override public Object getAttribute(String key) { Channel channel = getChannel(); if (channel == null) { return null; } return channel.getAttribute(key); }
@Override public Object getAttribute(String key) { Channel channel = getChannel(); if (channel == null) { return null; } return channel.getAttribute(key); }
private static void decreaseInstanceCount(Channel channel, String countkey) { try { Integer count = (Integer) channel.getAttribute(countkey); if (count == null || count <= 0) { return; } else { count--; } channel.setAttribute(countkey, count); } catch (Exception e) { logger.error(e.getMessage(), e); } }
private static void decreaseInstanceCount(Channel channel, String countkey) { try { Integer count = (Integer) channel.getAttribute(countkey); if (count == null || count <= 0) { return; } else { count--; } channel.setAttribute(countkey, count); } catch (Exception e) { logger.error(e.getMessage(), e); } }
private static void increaseInstanceCount(Channel channel, String countkey) { try { //ignore concurrent problem? Integer count = (Integer) channel.getAttribute(countkey); if (count == null) { count = 1; } else { count++; } channel.setAttribute(countkey, count); } catch (Exception e) { logger.error(e.getMessage(), e); } }
private static void increaseInstanceCount(Channel channel, String countkey) { try { //ignore concurrent problem? Integer count = (Integer) channel.getAttribute(countkey); if (count == null) { count = 1; } else { count++; } channel.setAttribute(countkey, count); } catch (Exception e) { logger.error(e.getMessage(), e); } }
private static boolean isInstancesOverLimit(Channel channel, URL url, String interfaceClass, int instid, boolean isServer) { Integer count = (Integer) channel.getAttribute(isServer ? getServerSideCountKey(channel, interfaceClass) : getClientSideCountKey(interfaceClass)); int limit = url.getParameter(Constants.CALLBACK_INSTANCES_LIMIT_KEY, Constants.DEFAULT_CALLBACK_INSTANCES); if (count != null && count >= limit) { //client side error throw new IllegalStateException("interface " + interfaceClass + " `s callback instances num exceed providers limit :" + limit + " ,current num: " + (count + 1) + ". The new callback service will not work !!! you can cancle the callback service which exported before. channel :" + channel); } else { return false; } }
private static boolean isInstancesOverLimit(Channel channel, URL url, String interfaceClass, int instid, boolean isServer) { Integer count = (Integer) channel.getAttribute(isServer ? getServerSideCountKey(channel, interfaceClass) : getClientSideCountKey(interfaceClass)); int limit = url.getParameter(Constants.CALLBACK_INSTANCES_LIMIT_KEY, Constants.DEFAULT_CALLBACK_INSTANCES); if (count != null && count >= limit) { //client side error throw new IllegalStateException("interface " + interfaceClass + " `s callback instances num exceed providers limit :" + limit + " ,current num: " + (count + 1) + ". The new callback service will not work !!! you can cancle the callback service which exported before. channel :" + channel); } else { return false; } }
static HeaderExchangeChannel getOrAddChannel(Channel ch) { if (ch == null) { return null; } HeaderExchangeChannel ret = (HeaderExchangeChannel) ch.getAttribute(CHANNEL_KEY); if (ret == null) { ret = new HeaderExchangeChannel(ch); if (ch.isConnected()) { ch.setAttribute(CHANNEL_KEY, ret); } } return ret; }
static HeaderExchangeChannel getOrAddChannel(Channel ch) { if (ch == null) { return null; } HeaderExchangeChannel ret = (HeaderExchangeChannel) ch.getAttribute(CHANNEL_KEY); if (ret == null) { ret = new HeaderExchangeChannel(ch); if (ch.isConnected()) { ch.setAttribute(CHANNEL_KEY, ret); } } return ret; }