com.ning.http.client.providers.netty
public class NettyConnectionsPool extends java.lang.Object implements ConnectionsPool<java.lang.String,org.jboss.netty.channel.Channel>
ConnectionsPool
based on a ConcurrentHashMap
Constructor and Description |
---|
NettyConnectionsPool(NettyAsyncHttpProvider provider) |
Modifier and Type | Method and Description |
---|---|
boolean |
canCacheConnection()
Return true if a connection can be cached.
|
void |
destroy()
Destroy all connections that has been cached by this instance.
|
boolean |
offer(java.lang.String uri,
org.jboss.netty.channel.Channel channel)
Add a connection tpo the pool
|
org.jboss.netty.channel.Channel |
poll(java.lang.String uri)
Remove the connection associated with the uri.
|
boolean |
removeAll(org.jboss.netty.channel.Channel channel)
Remove all connections from the cache.
|
java.lang.String |
toString() |
public NettyConnectionsPool(NettyAsyncHttpProvider provider)
public boolean offer(java.lang.String uri, org.jboss.netty.channel.Channel channel)
offer
in interface ConnectionsPool<java.lang.String,org.jboss.netty.channel.Channel>
uri
- a uri used to retrieve the cached connectionchannel
- an I/O connectionpublic org.jboss.netty.channel.Channel poll(java.lang.String uri)
poll
in interface ConnectionsPool<java.lang.String,org.jboss.netty.channel.Channel>
uri
- the uri used when invoking addConnectionpublic boolean removeAll(org.jboss.netty.channel.Channel channel)
removeAll
in interface ConnectionsPool<java.lang.String,org.jboss.netty.channel.Channel>
channel
- a connectionpublic boolean canCacheConnection()
ConnectionsPool.offer(Object, Object)
canCacheConnection
in interface ConnectionsPool<java.lang.String,org.jboss.netty.channel.Channel>
public void destroy()
destroy
in interface ConnectionsPool<java.lang.String,org.jboss.netty.channel.Channel>
public final java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2014. All Rights Reserved.