public interface

ConnectionsPool

com.ning.http.client.ConnectionsPool<U, V>
Known Indirect Subclasses

Class Overview

An interface used by an AsyncHttpProvider for caching http connections.

Summary

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

Public Methods

public abstract 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.

public abstract void destroy ()

Destroy all connections that has been cached by this instance.

public abstract 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.

public abstract 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

public abstract 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