Class DefaultChannelPool
- java.lang.Object
- 
- org.asynchttpclient.netty.channel.DefaultChannelPool
 
- 
- All Implemented Interfaces:
- ChannelPool
 
 public final class DefaultChannelPool extends Object implements ChannelPool A simple implementation ofChannelPoolbased on aConcurrentHashMap
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classDefaultChannelPool.PoolLeaseStrategy
 - 
Constructor SummaryConstructors Constructor Description DefaultChannelPool(Duration maxIdleTime, Duration connectionTtl, io.netty.util.Timer nettyTimer, Duration cleanerPeriod)DefaultChannelPool(Duration maxIdleTime, Duration connectionTtl, DefaultChannelPool.PoolLeaseStrategy poolLeaseStrategy, io.netty.util.Timer nettyTimer, Duration cleanerPeriod)DefaultChannelPool(AsyncHttpClientConfig config, io.netty.util.Timer hashedWheelTimer)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Destroy all channels that has been cached by this instance.voidflushPartitions(Predicate<Object> predicate)Flush partitions based on a predicateMap<String,Long>getIdleChannelCountPerHost()booleanisOpen()Return true if a channel can be cached.booleanoffer(io.netty.channel.Channel channel, Object partitionKey)Add a channel to the poolio.netty.channel.Channelpoll(Object partitionKey)Remove the channel associated with the uri.booleanremoveAll(io.netty.channel.Channel channel)Remove all channels from the cache.
 
- 
- 
- 
Constructor Detail- 
DefaultChannelPoolpublic DefaultChannelPool(AsyncHttpClientConfig config, io.netty.util.Timer hashedWheelTimer) 
 - 
DefaultChannelPoolpublic DefaultChannelPool(Duration maxIdleTime, Duration connectionTtl, io.netty.util.Timer nettyTimer, Duration cleanerPeriod) 
 - 
DefaultChannelPoolpublic DefaultChannelPool(Duration maxIdleTime, Duration connectionTtl, DefaultChannelPool.PoolLeaseStrategy poolLeaseStrategy, io.netty.util.Timer nettyTimer, Duration cleanerPeriod) 
 
- 
 - 
Method Detail- 
offerpublic boolean offer(io.netty.channel.Channel channel, Object partitionKey)Description copied from interface:ChannelPoolAdd a channel to the pool- Specified by:
- offerin interface- ChannelPool
- Parameters:
- channel- an I/O channel
- partitionKey- a key used to retrieve the cached channel
- Returns:
- true if added.
 
 - 
pollpublic io.netty.channel.Channel poll(Object partitionKey) Description copied from interface:ChannelPoolRemove the channel associated with the uri.- Specified by:
- pollin interface- ChannelPool
- Parameters:
- partitionKey- the partition used when invoking offer
- Returns:
- the channel associated with the uri
 
 - 
removeAllpublic boolean removeAll(io.netty.channel.Channel channel) Description copied from interface:ChannelPoolRemove all channels from the cache. A channel might have been associated with several uri.- Specified by:
- removeAllin interface- ChannelPool
- Parameters:
- channel- a channel
- Returns:
- the true if the channel has been removed
 
 - 
isOpenpublic boolean isOpen() Description copied from interface:ChannelPoolReturn true if a channel can be cached. An implementation can decide based on some rules to allow caching Calling this method is equivalent of checking the returned value ofChannelPool.offer(Channel, Object)- Specified by:
- isOpenin interface- ChannelPool
- Returns:
- true if a channel can be cached.
 
 - 
destroypublic void destroy() Description copied from interface:ChannelPoolDestroy all channels that has been cached by this instance.- Specified by:
- destroyin interface- ChannelPool
 
 - 
flushPartitionspublic void flushPartitions(Predicate<Object> predicate) Description copied from interface:ChannelPoolFlush partitions based on a predicate- Specified by:
- flushPartitionsin interface- ChannelPool
- Parameters:
- predicate- the predicate
 
 - 
getIdleChannelCountPerHostpublic Map<String,Long> getIdleChannelCountPerHost() - Specified by:
- getIdleChannelCountPerHostin interface- ChannelPool
- Returns:
- The number of idle channels per host.
 
 
- 
 
-