com.ning.http.client
Interface ConnectionsPool<U,V>

All Known Implementing Classes:
GrizzlyConnectionsPool, NettyConnectionsPool

public interface ConnectionsPool<U,V>

An interface used by an AsyncHttpProvider for caching http connections.


Method Summary
 boolean canCacheConnection()
          Return true if a connection can be cached.
 void destroy()
          Destroy all connections that has been cached by this instance.
 boolean offer(U uri, V connection)
          Add a connection tpo the pool
 V poll(U uri)
          Remove the connection associated with the uri.
 boolean removeAll(V connection)
          Remove all connections from the cache.
 

Method Detail

offer

boolean offer(U uri,
              V connection)
Add a connection tpo the pool

Parameters:
uri - a uri used to retrieve the cached connection
connection - an I/O connection
Returns:
true if added.

poll

V poll(U uri)
Remove the connection associated with the uri.

Parameters:
uri - the uri used when invoking addConnection
Returns:
the connection associated with the uri

removeAll

boolean removeAll(V connection)
Remove all connections from the cache. A connection might have been associated with several uri.

Parameters:
connection - a connection
Returns:
the true if the connection has been removed

canCacheConnection

boolean canCacheConnection()
Return true if a connection can be cached. A implementation can decide based on some rules to allow caching Calling this method is equivalent of checking the returned value of offer(Object, Object)

Returns:
true if a connection can be cached.

destroy

void destroy()
Destroy all connections that has been cached by this instance.



Copyright © 2014. All Rights Reserved.