private boolean isTTLExpired(Channel channel, long now) { if (maxConnectionTTLDisabled) return false; ChannelCreation creation = channelId2Creation.get(channelId(channel)); return creation != null && now - creation.creationTime >= maxConnectionTTL; }
private boolean isTTLExpired(Channel channel, long now) { if (maxConnectionTTLDisabled) return false; ChannelCreation creation = channelId2Creation.get(channelId(channel)); return creation != null && now - creation.creationTime >= maxConnectionTTL; }
/** * {@inheritDoc} */ public boolean removeAll(Channel channel) { ChannelCreation creation = channelId2Creation.remove(channelId(channel)); return !isClosed.get() && creation != null && partitions.get(creation.partitionKey).remove(channel); }
/** * {@inheritDoc} */ public boolean removeAll(Channel channel) { ChannelCreation creation = channelId2Creation.remove(channelId(channel)); return !isClosed.get() && creation != null && partitions.get(creation.partitionKey).remove(channel); }
private void close(Channel channel) { // FIXME pity to have to do this here Channels.setDiscard(channel); channelId2Creation.remove(channelId(channel)); Channels.silentlyCloseChannel(channel); }
/** * {@inheritDoc} */ public boolean offer(Channel channel, Object partitionKey) { if (isClosed.get() || (!sslConnectionPoolEnabled && channel.pipeline().get(SslHandler.class) != null)) return false; long now = millisTime(); if (isTTLExpired(channel, now)) return false; boolean added = partitions.computeIfAbsent(partitionKey, PARTITION_COMPUTER).add(new IdleChannel(channel, now)); if (added) channelId2Creation.putIfAbsent(channelId(channel), new ChannelCreation(now, partitionKey)); return added; }
/** * {@inheritDoc} */ public boolean offer(Channel channel, Object partitionKey) { if (isClosed.get() || (!sslConnectionPoolEnabled && channel.pipeline().get(SslHandler.class) != null)) return false; long now = millisTime(); if (isTTLExpired(channel, now)) return false; boolean added = partitions.computeIfAbsent(partitionKey, PARTITION_COMPUTER).add(new IdleChannel(channel, now)); if (added) channelId2Creation.putIfAbsent(channelId(channel), new ChannelCreation(now, partitionKey)); return added; }
private void close(Channel channel) { // FIXME pity to have to do this here Channels.setDiscard(channel); channelId2Creation.remove(channelId(channel)); Channels.silentlyCloseChannel(channel); }