public class NettyConnectionsPool extends Object implements ConnectionsPool<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(String uri,
org.jboss.netty.channel.Channel channel)
Add a connection tpo the pool
|
org.jboss.netty.channel.Channel |
poll(String uri)
Remove the connection associated with the uri.
|
boolean |
removeAll(org.jboss.netty.channel.Channel channel)
Remove all connections from the cache.
|
String |
toString() |
public NettyConnectionsPool(NettyAsyncHttpProvider provider)
public boolean offer(String uri, org.jboss.netty.channel.Channel channel)
offer
in interface ConnectionsPool<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(String uri)
poll
in interface ConnectionsPool<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<String,org.jboss.netty.channel.Channel>
channel
- a connectionpublic boolean canCacheConnection()
ConnectionsPool.offer(Object, Object)
canCacheConnection
in interface ConnectionsPool<String,org.jboss.netty.channel.Channel>
public void destroy()
destroy
in interface ConnectionsPool<String,org.jboss.netty.channel.Channel>
Copyright © 2015. All rights reserved.