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 TypeMethodDescriptionvoidvoidintintgetMaxPerRoute(T route) intReturns snapshot of all knows routesbooleanlease(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.voidReleases the pool entry back to the pool.voidsetDefaultMaxPerRoute(int max) voidsetMaxPerRoute(T route, int max) voidsetMaxTotal(int max) voidshutdown(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:ConnPoolAttempts to lease a connection for the given route and with the given state from the pool.- Specified by:
leasein 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:ConnPoolReleases the pool entry back to the pool. -
validatePendingRequests
public void validatePendingRequests() -
setMaxTotal
public void setMaxTotal(int max) - Specified by:
setMaxTotalin interfaceConnPoolControl<T>
-
getMaxTotal
public int getMaxTotal()- Specified by:
getMaxTotalin interfaceConnPoolControl<T>
-
setDefaultMaxPerRoute
public void setDefaultMaxPerRoute(int max) - Specified by:
setDefaultMaxPerRoutein interfaceConnPoolControl<T>
-
getDefaultMaxPerRoute
public int getDefaultMaxPerRoute()- Specified by:
getDefaultMaxPerRoutein interfaceConnPoolControl<T>
-
setMaxPerRoute
- Specified by:
setMaxPerRoutein interfaceConnPoolControl<T>
-
getMaxPerRoute
- Specified by:
getMaxPerRoutein interfaceConnPoolControl<T>
-
getTotalStats
- Specified by:
getTotalStatsin interfaceConnPoolControl<T>
-
getStats
- Specified by:
getStatsin interfaceConnPoolControl<T>
-
getRoutes
Returns snapshot of all knows routes- Since:
- 4.4
-
closeIdle
-
closeExpired
public void closeExpired() -
toString
-
AbstractNIOConnPool(ConnectingIOReactor, NIOConnFactory, SocketAddressResolver, int, int)