public final class DefaultChannelPool extends Object implements ChannelPool
ChannelPool
based on a ConcurrentHashMap
Constructor and Description |
---|
DefaultChannelPool(AsyncHttpClientConfig config,
io.netty.util.Timer hashedWheelTimer) |
DefaultChannelPool(int maxIdleTime,
int connectionTtl,
io.netty.util.Timer nettyTimer) |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy all channels that has been cached by this instance.
|
void |
flushPartition(Object partitionKey)
Flush a partition
|
void |
flushPartitions(ChannelPoolPartitionSelector selector)
Flush partitions based on a selector
|
boolean |
isOpen()
Return true if a channel can be cached.
|
boolean |
offer(Channel channel,
Object partitionKey)
Add a channel to the pool
|
Channel |
poll(Object partitionKey)
Remove the channel associated with the uri.
|
boolean |
removeAll(Channel channel)
Remove all channels from the cache.
|
public DefaultChannelPool(AsyncHttpClientConfig config, io.netty.util.Timer hashedWheelTimer)
public DefaultChannelPool(int maxIdleTime, int connectionTtl, io.netty.util.Timer nettyTimer)
public boolean offer(Channel channel, Object partitionKey)
offer
in interface ChannelPool
channel
- an I/O channelpartitionKey
- a key used to retrieve the cached channelpublic Channel poll(Object partitionKey)
poll
in interface ChannelPool
partitionKey
- the partition used when invoking offerpublic boolean removeAll(Channel channel)
removeAll
in interface ChannelPool
channel
- a channelpublic boolean isOpen()
ChannelPool.offer(Channel, Object)
isOpen
in interface ChannelPool
public void destroy()
destroy
in interface ChannelPool
public void flushPartition(Object partitionKey)
ChannelPool
flushPartition
in interface ChannelPool
partitionKey
- the partitionpublic void flushPartitions(ChannelPoolPartitionSelector selector)
ChannelPool
flushPartitions
in interface ChannelPool
selector
- the selectorCopyright © 2016. All Rights Reserved.