@Test @SuppressWarnings("unchecked") void assertReleaseChannelWhichCacheIsEmpty() throws Exception { setNettyClientKeyPool(); setUpReleaseChannel(); channelManager.releaseChannel(channel, "127.0.0.1:8091"); verify(keyedObjectPool).returnObject(nettyPoolKey, channel); }
void releaseChannel(Channel channel, String serverAddress) { if (null == channel || null == serverAddress) { return; } try { synchronized (channelLocks.get(serverAddress)) { Channel ch = channels.get(serverAddress); if (null == ch) { nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel); return; } if (ch.compareTo(channel) == 0) { if (LOGGER.isInfoEnabled()) { LOGGER.info("return to pool, rm channel:" + channel); } destroyChannel(serverAddress, channel); } else { nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel); } } } catch (Exception exx) { LOGGER.error(exx.getMessage()); } }
NettyClientChannelManager { void releaseChannel(Channel channel, String serverAddress) { if (null == channel || null == serverAddress) { return; } try { synchronized (channelLocks.get(serverAddress)) { Channel ch = channels.get(serverAddress); if (null == ch) { nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel); return; } if (ch.compareTo(channel) == 0) { if (LOGGER.isInfoEnabled()) { LOGGER.info("return to pool, rm channel:" + channel); } destroyChannel(serverAddress, channel); } else { nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel); } } } catch (Exception exx) { LOGGER.error(exx.getMessage()); } } }
NettyClientChannelManager { void releaseChannel(Channel channel, String serverAddress) { if (null == channel || null == serverAddress) { return; } try { synchronized (channelLocks.get(serverAddress)) { Channel ch = channels.get(serverAddress); if (null == ch) { nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel); return; } if (ch.compareTo(channel) == 0) { if (LOGGER.isInfoEnabled()) { LOGGER.info("return to pool, rm channel:" + channel); } destroyChannel(serverAddress, channel); } else { nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel); } } } catch (Exception exx) { LOGGER.error(exx.getMessage()); } } NettyClientChannelManager(final NettyPoolableFactory keyPoolableFactory, final Function<String, NettyPoolKey> poolKeyFunction,
                                     final NettyClientConfig clientConfig); }
NettyClientChannelManager { void releaseChannel(Channel channel, String serverAddress) { if (null == channel || null == serverAddress) { return; } try { synchronized (channelLocks.get(serverAddress)) { Channel ch = channels.get(serverAddress); if (null == ch) { nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel); return; } if (ch.compareTo(channel) == 0) { if (LOGGER.isInfoEnabled()) { LOGGER.info("return to pool, rm channel:" + channel); } destroyChannel(serverAddress, channel); } else { nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel); } } } catch (Exception exx) { LOGGER.error(exx.getMessage()); } } NettyClientChannelManager(final NettyPoolableFactory keyPoolableFactory, final Function<String, NettyPoolKey> poolKeyFunction,
                                     final NettyClientConfig clientConfig);  }
NettyClientChannelManager { void releaseChannel(Channel channel, String serverAddress) { if (null == channel || null == serverAddress) { return; } try { synchronized (channelLocks.get(serverAddress)) { Channel ch = channels.get(serverAddress); if (null == ch) { nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel); return; } if (ch.compareTo(channel) == 0) { if (LOGGER.isInfoEnabled()) { LOGGER.info("return to pool, rm channel:" + channel); } destroyChannel(serverAddress, channel); } else { nettyClientKeyPool.returnObject(poolKeyMap.get(serverAddress), channel); } } } catch (Exception exx) { LOGGER.error(exx.getMessage()); } } NettyClientChannelManager(final NettyPoolableFactory keyPoolableFactory, final Function<String, NettyPoolKey> poolKeyFunction,
                                     final NettyClientConfig clientConfig);   }