public final void tryToOfferChannelToPool(Channel channel, boolean keepAlive, Object partitionKey) { if (channel.isActive() && keepAlive && channel.isActive()) { LOGGER.debug("Adding key: {} for channel {}", partitionKey, channel); Channels.setDiscard(channel); channelPool.offer(channel, partitionKey); if (maxConnectionsPerHostEnabled) channelId2PartitionKey.putIfAbsent(channel, partitionKey); } else { // not offered closeChannel(channel); } }
public final void tryToOfferChannelToPool(Channel channel, AsyncHandler<?> handler, boolean keepAlive, Object partitionKey) { if (channel.isActive() && keepAlive && channel.isActive()) { LOGGER.debug("Adding key: {} for channel {}", partitionKey, channel); Channels.setDiscard(channel); if (handler instanceof AsyncHandlerExtensions) { AsyncHandlerExtensions.class.cast(handler).onConnectionOffer(channel); } channelPool.offer(channel, partitionKey); if (maxConnectionsPerHostEnabled) channelId2PartitionKey.putIfAbsent(channel, partitionKey); } else { // not offered closeChannel(channel); } }
public final void tryToOfferChannelToPool(Channel channel, AsyncHandler<?> handler, boolean keepAlive, Object partitionKey) { if (channel.isConnected() && keepAlive && channel.isReadable()) { LOGGER.debug("Adding key: {} for channel {}", partitionKey, channel); Channels.setDiscard(channel); if (handler instanceof AsyncHandlerExtensions) { AsyncHandlerExtensions.class.cast(handler).onConnectionOffer(channel); } channelPool.offer(channel, partitionKey); if (maxConnectionsPerHostEnabled) channelId2PartitionKey.putIfAbsent(channel.getId(), partitionKey); } else { // not offered closeChannel(channel); } }
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); channelPool.offer(channel, partitionKey); if (maxConnectionsPerHostEnabled) channelId2PartitionKey.putIfAbsent(channel.getId(), partitionKey); } else { // not offered closeChannel(channel); } }