Package org.apache.http.nio.pool
Class AbstractNIOConnPool<T,C,E extends PoolEntry<T,C>>
java.lang.Object
org.apache.http.nio.pool.AbstractNIOConnPool<T,C,E>
- Type Parameters:
T
- routeC
- connection objectE
- pool entry
- All Implemented Interfaces:
ConnPool<T,
,E> ConnPoolControl<T>
- Direct Known Subclasses:
BasicNIOConnPool
@Contract(threading=SAFE_CONDITIONAL)
public abstract class AbstractNIOConnPool<T,C,E extends PoolEntry<T,C>>
extends Object
implements ConnPool<T,E>, ConnPoolControl<T>
Abstract non-blocking connection pool.
- Since:
- 4.2
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractNIOConnPool
(ConnectingIOReactor ioreactor, NIOConnFactory<T, C> connFactory, int defaultMaxPerRoute, int maxTotal) Deprecated.AbstractNIOConnPool
(ConnectingIOReactor ioreactor, NIOConnFactory<T, C> connFactory, SocketAddressResolver<T> addressResolver, int defaultMaxPerRoute, int maxTotal) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
int
int
getMaxPerRoute
(T route) int
Returns snapshot of all knows routesboolean
lease
(T route, Object state, long connectTimeout, long leaseTimeout, TimeUnit tunit, FutureCallback<E> callback) lease
(T route, Object state, FutureCallback<E> callback) Attempts to lease a connection for the given route and with the given state from the pool.void
Releases the pool entry back to the pool.void
setDefaultMaxPerRoute
(int max) void
setMaxPerRoute
(T route, int max) void
setMaxTotal
(int max) void
shutdown
(long waitMs) toString()
void
-
Constructor Details
-
AbstractNIOConnPool
@Deprecated public AbstractNIOConnPool(ConnectingIOReactor ioreactor, NIOConnFactory<T, C> connFactory, int defaultMaxPerRoute, int maxTotal) -
AbstractNIOConnPool
public AbstractNIOConnPool(ConnectingIOReactor ioreactor, NIOConnFactory<T, C> connFactory, SocketAddressResolver<T> addressResolver, int defaultMaxPerRoute, int maxTotal) - Since:
- 4.3
-
-
Method Details
-
isShutdown
public boolean isShutdown() -
shutdown
- Throws:
IOException
-
lease
-
lease
public Future<E> lease(T route, Object state, long connectTimeout, long leaseTimeout, TimeUnit tunit, FutureCallback<E> callback) - Since:
- 4.3
-
lease
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 interfaceConnPool<T,
C> - 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 benull
.callback
- operation completion callback.- Returns:
- future for a leased pool entry.
-
lease
-
release
Description copied from interface:ConnPool
Releases the pool entry back to the pool. -
validatePendingRequests
public void validatePendingRequests() -
setMaxTotal
public void setMaxTotal(int max) - Specified by:
setMaxTotal
in interfaceConnPoolControl<T>
-
getMaxTotal
public int getMaxTotal()- Specified by:
getMaxTotal
in interfaceConnPoolControl<T>
-
setDefaultMaxPerRoute
public void setDefaultMaxPerRoute(int max) - Specified by:
setDefaultMaxPerRoute
in interfaceConnPoolControl<T>
-
getDefaultMaxPerRoute
public int getDefaultMaxPerRoute()- Specified by:
getDefaultMaxPerRoute
in interfaceConnPoolControl<T>
-
setMaxPerRoute
- Specified by:
setMaxPerRoute
in interfaceConnPoolControl<T>
-
getMaxPerRoute
- Specified by:
getMaxPerRoute
in interfaceConnPoolControl<T>
-
getTotalStats
- Specified by:
getTotalStats
in interfaceConnPoolControl<T>
-
getStats
- Specified by:
getStats
in interfaceConnPoolControl<T>
-
getRoutes
Returns snapshot of all knows routes- Since:
- 4.4
-
closeIdle
-
closeExpired
public void closeExpired() -
toString
-
AbstractNIOConnPool(ConnectingIOReactor, NIOConnFactory, SocketAddressResolver, int, int)