org.apache.http.impl.nio.pool
Class BasicNIOConnPool
java.lang.Object
org.apache.http.nio.pool.AbstractNIOConnPool<HttpHost,NHttpClientConnection,BasicNIOPoolEntry>
org.apache.http.impl.nio.pool.BasicNIOConnPool
- All Implemented Interfaces:
- ConnPool<HttpHost,BasicNIOPoolEntry>, ConnPoolControl<HttpHost>
@ThreadSafe
public class BasicNIOConnPool
- extends AbstractNIOConnPool<HttpHost,NHttpClientConnection,BasicNIOPoolEntry>
A very basic ConnPool
implementation that represents a pool
of non-blocking NHttpClientConnection
connections identified by
an HttpHost
instance. Please note this pool implementation
does not support complex routes via a proxy cannot differentiate between
direct and proxied connections.
The following parameters can be used to customize the behavior of this
class:
- Since:
- 4.2
- See Also:
HttpHost
Methods inherited from class org.apache.http.nio.pool.AbstractNIOConnPool |
closeExpired, closeIdle, getDefaultMaxPerRoute, getMaxPerRoute, getMaxTotal, getStats, getTotalStats, isShutdown, lease, release, requestCancelled, requestCompleted, requestFailed, requestTimeout, setDefaultMaxPerRoute, setMaxPerRoute, setMaxTotal, shutdown, toString, validatePendingRequests |
BasicNIOConnPool
public BasicNIOConnPool(ConnectingIOReactor ioreactor,
NIOConnFactory<HttpHost,NHttpClientConnection> connFactory,
HttpParams params)
BasicNIOConnPool
public BasicNIOConnPool(ConnectingIOReactor ioreactor,
HttpParams params)
resolveRemoteAddress
protected SocketAddress resolveRemoteAddress(HttpHost host)
- Specified by:
resolveRemoteAddress
in class AbstractNIOConnPool<HttpHost,NHttpClientConnection,BasicNIOPoolEntry>
resolveLocalAddress
protected SocketAddress resolveLocalAddress(HttpHost host)
- Specified by:
resolveLocalAddress
in class AbstractNIOConnPool<HttpHost,NHttpClientConnection,BasicNIOPoolEntry>
createEntry
protected BasicNIOPoolEntry createEntry(HttpHost host,
NHttpClientConnection conn)
- Specified by:
createEntry
in class AbstractNIOConnPool<HttpHost,NHttpClientConnection,BasicNIOPoolEntry>
lease
public Future<BasicNIOPoolEntry> lease(HttpHost route,
Object state,
FutureCallback<BasicNIOPoolEntry> callback)
- Description copied from interface:
ConnPool
- Attempts to lease a connection for the given route and with the given
state from the pool.
- Specified by:
lease
in interface ConnPool<HttpHost,BasicNIOPoolEntry>
- Overrides:
lease
in class AbstractNIOConnPool<HttpHost,NHttpClientConnection,BasicNIOPoolEntry>
- Parameters:
route
- route of the connection.state
- arbitrary object that represents a particular state
(usually a security principal or a unique token identifying
the user whose credentials have been used while establishing the connection).
May be null
.callback
- operation completion callback.
- Returns:
- future for a leased pool entry.
lease
public Future<BasicNIOPoolEntry> lease(HttpHost route,
Object state)
- Overrides:
lease
in class AbstractNIOConnPool<HttpHost,NHttpClientConnection,BasicNIOPoolEntry>
Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.