public final void tryToOfferChannelToPool(Channel channel, boolean keepAlive, Object partitionKey) { if (channel.isConnected() && keepAlive && channel.isReadable()) { LOGGER.debug("Adding key: {} for channel {}", partitionKey, channel); Channels.setDiscard(channel); if (channelPool.offer(channel, partitionKey)) { if (maxConnectionsPerHostEnabled) channelId2PartitionKey.putIfAbsent(channel.getId(), partitionKey); } else { // rejected by pool closeChannel(channel); } } else { // not offered closeChannel(channel); } }
public final void tryToOfferChannelToPool(Channel channel, boolean keepAlive, String poolKey) { if (keepAlive && channel.isReadable()) { LOGGER.debug("Adding key: {} for channel {}", poolKey, channel); channelPool.offer(channel, poolKey); if (maxConnectionsPerHostEnabled) channelId2KeyPool.putIfAbsent(channel.getId(), poolKey); Channels.setDiscard(channel); } else { // not offered closeChannel(channel); } }