@Override public void propertyChange(PropertyChangeEvent evt) { if (null == evt.getNewValue()) return; NettyConnection source = (NettyConnection) evt.getSource(); NetConnectionType newValue = (NetConnectionType) evt.getNewValue(); Channel channel = source.getChannel(); logger.info("{} Update Codec", channel); try { enableChannel(newValue, channel); } catch (Exception e) { e.printStackTrace(); } }
public Histogram getTransmitHistogram(Channel channel, int clientPort) { Histogram netTransTime = networkTransmitTimeMap.get(channel); if (netTransTime == null) { InetSocketAddress sockAddr = (InetSocketAddress) (channel.getRemoteAddress()); String nettyConnection = NettyConnection.mkString( sockAddr.getAddress().getHostAddress(), clientPort, localIp, localPort); try { netTransTime = JStormMetrics.registerWorkerHistogram( MetricDef.NETTY_SRV_MSG_TRANS_TIME, nettyConnection); } catch (Exception e) { LOG.error("{}.{} has been register", MetricDef.NETTY_SRV_MSG_TRANS_TIME, nettyConnection); removeTransmitHistogram(nettyConnection); return null; } networkTransmitTimeMap.put(channel, netTransTime); transmitNameMap.put(channel, nettyConnection); LOG.info("Register Transmit Histogram of {}, channel {}", nettyConnection, channel); } return netTransTime; }