com.ning.http.client.providers.jdk
Class JDKConnectionsPool

java.lang.Object
  extended by com.ning.http.client.providers.jdk.JDKConnectionsPool
All Implemented Interfaces:
ConnectionsPool<String,URLConnection>

public class JDKConnectionsPool
extends Object
implements ConnectionsPool<String,URLConnection>


Constructor Summary
JDKConnectionsPool(AsyncHttpClientConfig config)
           
 
Method Summary
 boolean addConnection(String uri, URLConnection connection)
          Add a connection tpo the pool
 boolean canCacheConnection()
          Return true if a connection can be cached.
 void destroy()
          Destroy all connections that has been cached by this instance.
 URLConnection getConnection(String uri)
          Return the connection associated with the uri
 boolean removeAllConnections(URLConnection connection)
          Remove all connections from the cache.
 URLConnection removeConnection(String uri)
          Remove the connection associated with the uri.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDKConnectionsPool

public JDKConnectionsPool(AsyncHttpClientConfig config)
Method Detail

addConnection

public boolean addConnection(String uri,
                             URLConnection connection)
Description copied from interface: ConnectionsPool
Add a connection tpo the pool

Specified by:
addConnection in interface ConnectionsPool<String,URLConnection>
Parameters:
uri - a uri used to retrieve the cached connection
connection - an I/O connection
Returns:
true if added.

getConnection

public URLConnection getConnection(String uri)
Description copied from interface: ConnectionsPool
Return the connection associated with the uri

Specified by:
getConnection in interface ConnectionsPool<String,URLConnection>
Parameters:
uri - the uri used when invoking addConnection
Returns:
the connection associated with the uri

removeConnection

public URLConnection removeConnection(String uri)
Description copied from interface: ConnectionsPool
Remove the connection associated with the uri.

Specified by:
removeConnection in interface ConnectionsPool<String,URLConnection>
Parameters:
uri - the uri used when invoking addConnection
Returns:
the connection associated with the uri

removeAllConnections

public boolean removeAllConnections(URLConnection connection)
Description copied from interface: ConnectionsPool
Remove all connections from the cache. A connection might have been associated with several uri.

Specified by:
removeAllConnections in interface ConnectionsPool<String,URLConnection>
Parameters:
connection - a connection
Returns:
the true if the connection has been removed

canCacheConnection

public boolean canCacheConnection()
Description copied from interface: ConnectionsPool
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 ConnectionsPool.addConnection(Object, Object)

Specified by:
canCacheConnection in interface ConnectionsPool<String,URLConnection>
Returns:
true if a connection can be cached.

destroy

public void destroy()
Description copied from interface: ConnectionsPool
Destroy all connections that has been cached by this instance.

Specified by:
destroy in interface ConnectionsPool<String,URLConnection>


Copyright © 2010. All Rights Reserved.