org.apache.http.impl.nio.conn
Class PoolingNHttpClientConnectionManager

java.lang.Object
  extended by org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager
All Implemented Interfaces:
NHttpClientConnectionManager, ConnPoolControl<HttpRoute>

public class PoolingNHttpClientConnectionManager
extends Object
implements NHttpClientConnectionManager, ConnPoolControl<HttpRoute>


Constructor Summary
PoolingNHttpClientConnectionManager(org.apache.http.nio.reactor.ConnectingIOReactor ioreactor)
           
PoolingNHttpClientConnectionManager(org.apache.http.nio.reactor.ConnectingIOReactor ioreactor, NHttpConnectionFactory<ManagedNHttpClientConnection> connFactory)
           
PoolingNHttpClientConnectionManager(org.apache.http.nio.reactor.ConnectingIOReactor ioreactor, NHttpConnectionFactory<ManagedNHttpClientConnection> connFactory, DnsResolver dnsResolver)
           
PoolingNHttpClientConnectionManager(org.apache.http.nio.reactor.ConnectingIOReactor ioreactor, NHttpConnectionFactory<ManagedNHttpClientConnection> connFactory, Registry<SchemeIOSessionFactory> iosessionFactoryRegistry)
           
PoolingNHttpClientConnectionManager(org.apache.http.nio.reactor.ConnectingIOReactor ioreactor, NHttpConnectionFactory<ManagedNHttpClientConnection> connFactory, Registry<SchemeIOSessionFactory> iosessionFactoryRegistry, DnsResolver dnsResolver)
           
PoolingNHttpClientConnectionManager(org.apache.http.nio.reactor.ConnectingIOReactor ioreactor, NHttpConnectionFactory<ManagedNHttpClientConnection> connFactory, Registry<SchemeIOSessionFactory> iosessionFactoryRegistry, SchemePortResolver schemePortResolver, DnsResolver dnsResolver, long timeToLive, TimeUnit tunit)
           
PoolingNHttpClientConnectionManager(org.apache.http.nio.reactor.ConnectingIOReactor ioreactor, Registry<SchemeIOSessionFactory> iosessionFactoryRegistry)
           
 
Method Summary
 void closeExpiredConnections()
          Closes all expired connections in the pool.
 void closeIdleConnections(long idleTimeout, TimeUnit tunit)
          Closes idle connections in the pool.
 void execute(org.apache.http.nio.reactor.IOEventDispatch eventDispatch)
           
protected  void finalize()
           
 ConnectionConfig getConnectionConfig(HttpHost host)
           
 ConnectionConfig getDefaultConnectionConfig()
           
 int getDefaultMaxPerRoute()
           
 SocketConfig getDefaultSocketConfig()
           
 int getMaxPerRoute(HttpRoute route)
           
 int getMaxTotal()
           
 SocketConfig getSocketConfig(HttpHost host)
           
 PoolStats getStats(HttpRoute route)
           
 PoolStats getTotalStats()
           
 void initialize(org.apache.http.nio.NHttpClientConnection managedConn, HttpRoute route, HttpContext context)
           
 boolean isRouteComplete(org.apache.http.nio.NHttpClientConnection managedConn)
           
 void releaseConnection(org.apache.http.nio.NHttpClientConnection managedConn, Object state, long keepalive, TimeUnit tunit)
          Releases a connection for use by others.
 Future<org.apache.http.nio.NHttpClientConnection> requestConnection(HttpRoute route, Object state, long connectTimeout, TimeUnit tunit, FutureCallback<org.apache.http.nio.NHttpClientConnection> callback)
          Returns a Future for a NHttpClientConnection.
 void routeComplete(org.apache.http.nio.NHttpClientConnection managedConn, HttpRoute route, HttpContext context)
           
 void setConnectionConfig(HttpHost host, ConnectionConfig connectionConfig)
           
 void setDefaultConnectionConfig(ConnectionConfig defaultConnectionConfig)
           
 void setDefaultMaxPerRoute(int max)
           
 void setDefaultSocketConfig(SocketConfig defaultSocketConfig)
           
 void setMaxPerRoute(HttpRoute route, int max)
           
 void setMaxTotal(int max)
           
 void setSocketConfig(HttpHost host, SocketConfig socketConfig)
           
 void shutdown()
          Shuts down this connection manager and releases allocated resources.
 void shutdown(long waitMs)
           
 void upgrade(org.apache.http.nio.NHttpClientConnection managedConn, HttpRoute route, HttpContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PoolingNHttpClientConnectionManager

public PoolingNHttpClientConnectionManager(org.apache.http.nio.reactor.ConnectingIOReactor ioreactor)

PoolingNHttpClientConnectionManager

public PoolingNHttpClientConnectionManager(org.apache.http.nio.reactor.ConnectingIOReactor ioreactor,
                                           Registry<SchemeIOSessionFactory> iosessionFactoryRegistry)

PoolingNHttpClientConnectionManager

public PoolingNHttpClientConnectionManager(org.apache.http.nio.reactor.ConnectingIOReactor ioreactor,
                                           NHttpConnectionFactory<ManagedNHttpClientConnection> connFactory,
                                           DnsResolver dnsResolver)

PoolingNHttpClientConnectionManager

public PoolingNHttpClientConnectionManager(org.apache.http.nio.reactor.ConnectingIOReactor ioreactor,
                                           NHttpConnectionFactory<ManagedNHttpClientConnection> connFactory)

PoolingNHttpClientConnectionManager

public PoolingNHttpClientConnectionManager(org.apache.http.nio.reactor.ConnectingIOReactor ioreactor,
                                           NHttpConnectionFactory<ManagedNHttpClientConnection> connFactory,
                                           Registry<SchemeIOSessionFactory> iosessionFactoryRegistry)

PoolingNHttpClientConnectionManager

public PoolingNHttpClientConnectionManager(org.apache.http.nio.reactor.ConnectingIOReactor ioreactor,
                                           NHttpConnectionFactory<ManagedNHttpClientConnection> connFactory,
                                           Registry<SchemeIOSessionFactory> iosessionFactoryRegistry,
                                           DnsResolver dnsResolver)

PoolingNHttpClientConnectionManager

public PoolingNHttpClientConnectionManager(org.apache.http.nio.reactor.ConnectingIOReactor ioreactor,
                                           NHttpConnectionFactory<ManagedNHttpClientConnection> connFactory,
                                           Registry<SchemeIOSessionFactory> iosessionFactoryRegistry,
                                           SchemePortResolver schemePortResolver,
                                           DnsResolver dnsResolver,
                                           long timeToLive,
                                           TimeUnit tunit)
Method Detail

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

execute

public void execute(org.apache.http.nio.reactor.IOEventDispatch eventDispatch)
             throws IOException
Specified by:
execute in interface NHttpClientConnectionManager
Throws:
IOException

shutdown

public void shutdown(long waitMs)
              throws IOException
Throws:
IOException

shutdown

public void shutdown()
              throws IOException
Description copied from interface: NHttpClientConnectionManager
Shuts down this connection manager and releases allocated resources. This includes closing all connections, whether they are currently used or not.

Specified by:
shutdown in interface NHttpClientConnectionManager
Throws:
IOException

requestConnection

public Future<org.apache.http.nio.NHttpClientConnection> requestConnection(HttpRoute route,
                                                                           Object state,
                                                                           long connectTimeout,
                                                                           TimeUnit tunit,
                                                                           FutureCallback<org.apache.http.nio.NHttpClientConnection> callback)
Description copied from interface: NHttpClientConnectionManager
Returns a Future for a NHttpClientConnection.

Specified by:
requestConnection in interface NHttpClientConnectionManager

releaseConnection

public void releaseConnection(org.apache.http.nio.NHttpClientConnection managedConn,
                              Object state,
                              long keepalive,
                              TimeUnit tunit)
Description copied from interface: NHttpClientConnectionManager
Releases a connection for use by others. You may optionally specify how long the connection is valid to be reused. Values <= 0 are considered to be valid forever. If the connection is not marked as reusable, the connection will not be reused regardless of the valid duration. If the connection has been released before, the call will be ignored.

Specified by:
releaseConnection in interface NHttpClientConnectionManager
Parameters:
managedConn - the connection to release
keepalive - the duration of time this connection is valid for reuse
tunit - the unit of time validDuration is measured in
See Also:
NHttpClientConnectionManager.closeExpiredConnections()

initialize

public void initialize(org.apache.http.nio.NHttpClientConnection managedConn,
                       HttpRoute route,
                       HttpContext context)
                throws IOException
Specified by:
initialize in interface NHttpClientConnectionManager
Throws:
IOException

upgrade

public void upgrade(org.apache.http.nio.NHttpClientConnection managedConn,
                    HttpRoute route,
                    HttpContext context)
             throws IOException
Specified by:
upgrade in interface NHttpClientConnectionManager
Throws:
IOException

routeComplete

public void routeComplete(org.apache.http.nio.NHttpClientConnection managedConn,
                          HttpRoute route,
                          HttpContext context)
Specified by:
routeComplete in interface NHttpClientConnectionManager

isRouteComplete

public boolean isRouteComplete(org.apache.http.nio.NHttpClientConnection managedConn)
Specified by:
isRouteComplete in interface NHttpClientConnectionManager

closeIdleConnections

public void closeIdleConnections(long idleTimeout,
                                 TimeUnit tunit)
Description copied from interface: NHttpClientConnectionManager
Closes idle connections in the pool. Open connections in the pool that have not been used for the timespan given by the argument will be closed. Currently allocated connections are not subject to this method. Times will be checked with milliseconds precision All expired connections will also be closed.

Specified by:
closeIdleConnections in interface NHttpClientConnectionManager
Parameters:
idleTimeout - the idle time of connections to be closed
tunit - the unit for the idletime
See Also:
NHttpClientConnectionManager.closeExpiredConnections()

closeExpiredConnections

public void closeExpiredConnections()
Description copied from interface: NHttpClientConnectionManager
Closes all expired connections in the pool. Open connections in the pool that have not been used for the timespan defined when the connection was released will be closed. Currently allocated connections are not subject to this method. Times will be checked with milliseconds precision.

Specified by:
closeExpiredConnections in interface NHttpClientConnectionManager

getMaxTotal

public int getMaxTotal()
Specified by:
getMaxTotal in interface ConnPoolControl<HttpRoute>

setMaxTotal

public void setMaxTotal(int max)
Specified by:
setMaxTotal in interface ConnPoolControl<HttpRoute>

getDefaultMaxPerRoute

public int getDefaultMaxPerRoute()
Specified by:
getDefaultMaxPerRoute in interface ConnPoolControl<HttpRoute>

setDefaultMaxPerRoute

public void setDefaultMaxPerRoute(int max)
Specified by:
setDefaultMaxPerRoute in interface ConnPoolControl<HttpRoute>

getMaxPerRoute

public int getMaxPerRoute(HttpRoute route)
Specified by:
getMaxPerRoute in interface ConnPoolControl<HttpRoute>

setMaxPerRoute

public void setMaxPerRoute(HttpRoute route,
                           int max)
Specified by:
setMaxPerRoute in interface ConnPoolControl<HttpRoute>

getTotalStats

public PoolStats getTotalStats()
Specified by:
getTotalStats in interface ConnPoolControl<HttpRoute>

getStats

public PoolStats getStats(HttpRoute route)
Specified by:
getStats in interface ConnPoolControl<HttpRoute>

getDefaultSocketConfig

public SocketConfig getDefaultSocketConfig()

setDefaultSocketConfig

public void setDefaultSocketConfig(SocketConfig defaultSocketConfig)

getDefaultConnectionConfig

public ConnectionConfig getDefaultConnectionConfig()

setDefaultConnectionConfig

public void setDefaultConnectionConfig(ConnectionConfig defaultConnectionConfig)

getSocketConfig

public SocketConfig getSocketConfig(HttpHost host)

setSocketConfig

public void setSocketConfig(HttpHost host,
                            SocketConfig socketConfig)

getConnectionConfig

public ConnectionConfig getConnectionConfig(HttpHost host)

setConnectionConfig

public void setConnectionConfig(HttpHost host,
                                ConnectionConfig connectionConfig)


Copyright © 2010-2013 The Apache Software Foundation. All Rights Reserved.