Package org.asynchttpclient.channel
Interface ChannelPool
-
- All Known Implementing Classes:
DefaultChannelPool
,NoopChannelPool
public interface ChannelPool
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
destroy()
Destroy all channels that has been cached by this instance.void
flushPartitions(Predicate<Object> predicate)
Flush partitions based on a predicateMap<String,Long>
getIdleChannelCountPerHost()
boolean
isOpen()
Return true if a channel can be cached.boolean
offer(io.netty.channel.Channel channel, Object partitionKey)
Add a channel to the poolio.netty.channel.Channel
poll(Object partitionKey)
Remove the channel associated with the uri.boolean
removeAll(io.netty.channel.Channel channel)
Remove all channels from the cache.
-
-
-
Method Detail
-
offer
boolean offer(io.netty.channel.Channel channel, Object partitionKey)
Add a channel to the pool- Parameters:
channel
- an I/O channelpartitionKey
- a key used to retrieve the cached channel- Returns:
- true if added.
-
poll
io.netty.channel.Channel poll(Object partitionKey)
Remove the channel associated with the uri.- Parameters:
partitionKey
- the partition used when invoking offer- Returns:
- the channel associated with the uri
-
removeAll
boolean removeAll(io.netty.channel.Channel channel)
Remove all channels from the cache. A channel might have been associated with several uri.- Parameters:
channel
- a channel- Returns:
- the true if the channel has been removed
-
isOpen
boolean isOpen()
Return true if a channel can be cached. A implementation can decide based on some rules to allow caching Calling this method is equivalent of checking the returned value ofoffer(Channel, Object)
- Returns:
- true if a channel can be cached.
-
destroy
void destroy()
Destroy all channels that has been cached by this instance.
-
flushPartitions
void flushPartitions(Predicate<Object> predicate)
Flush partitions based on a predicate- Parameters:
predicate
- the predicate
-
-