Package org.apache.http.nio.pool
Class AbstractNIOConnPool<T,C,E extends org.apache.http.pool.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:
org.apache.http.pool.ConnPool<T,E>
,org.apache.http.pool.ConnPoolControl<T>
- Direct Known Subclasses:
BasicNIOConnPool
@Contract(threading=SAFE_CONDITIONAL) public abstract class AbstractNIOConnPool<T,C,E extends org.apache.http.pool.PoolEntry<T,C>> extends java.lang.Object implements org.apache.http.pool.ConnPool<T,E>, org.apache.http.pool.ConnPoolControl<T>
Abstract non-blocking connection pool.- Since:
- 4.2
-
-
Constructor Summary
Constructors Constructor Description AbstractNIOConnPool(ConnectingIOReactor ioReactor, NIOConnFactory<T,C> connFactory, int defaultMaxPerRoute, int maxTotal)
AbstractNIOConnPool(ConnectingIOReactor ioReactor, NIOConnFactory<T,C> connFactory, SocketAddressResolver<T> addressResolver, int defaultMaxPerRoute, int maxTotal)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
closeExpired()
void
closeIdle(long idletime, java.util.concurrent.TimeUnit timeUnit)
protected abstract E
createEntry(T route, C conn)
protected void
enumAvailable(org.apache.http.pool.PoolEntryCallback<T,C> callback)
Enumerates all available connections.protected void
enumEntries(java.util.Iterator<E> it, org.apache.http.pool.PoolEntryCallback<T,C> callback)
Deprecated.(4.3.2)protected void
enumLeased(org.apache.http.pool.PoolEntryCallback<T,C> callback)
Enumerates all leased connections.int
getDefaultMaxPerRoute()
int
getMaxPerRoute(T route)
int
getMaxTotal()
java.util.Set<T>
getRoutes()
Returns snapshot of all knows routesorg.apache.http.pool.PoolStats
getStats(T route)
org.apache.http.pool.PoolStats
getTotalStats()
boolean
isShutdown()
java.util.concurrent.Future<E>
lease(T route, java.lang.Object state)
java.util.concurrent.Future<E>
lease(T route, java.lang.Object state, long connectTimeout, long leaseTimeout, java.util.concurrent.TimeUnit timeUnit, org.apache.http.concurrent.FutureCallback<E> callback)
java.util.concurrent.Future<E>
lease(T route, java.lang.Object state, long connectTimeout, java.util.concurrent.TimeUnit timeUnit, org.apache.http.concurrent.FutureCallback<E> callback)
java.util.concurrent.Future<E>
lease(T route, java.lang.Object state, org.apache.http.concurrent.FutureCallback<E> callback)
protected void
onLease(E entry)
protected void
onRelease(E entry)
protected void
onReuse(E entry)
void
release(E entry, boolean reusable)
protected void
requestCancelled(SessionRequest request)
protected void
requestCompleted(SessionRequest request)
protected void
requestFailed(SessionRequest request)
protected void
requestTimeout(SessionRequest request)
protected java.net.SocketAddress
resolveLocalAddress(T route)
Deprecated.(4.3) useSocketAddressResolver
protected java.net.SocketAddress
resolveRemoteAddress(T route)
Deprecated.(4.3) useSocketAddressResolver
void
setDefaultMaxPerRoute(int max)
void
setMaxPerRoute(T route, int max)
void
setMaxTotal(int max)
void
shutdown(long waitMs)
java.lang.String
toString()
void
validatePendingRequests()
-
-
-
Constructor Detail
-
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 Detail
-
resolveRemoteAddress
@Deprecated protected java.net.SocketAddress resolveRemoteAddress(T route)
Deprecated.(4.3) useSocketAddressResolver
-
resolveLocalAddress
@Deprecated protected java.net.SocketAddress resolveLocalAddress(T route)
Deprecated.(4.3) useSocketAddressResolver
-
onLease
protected void onLease(E entry)
- Since:
- 4.3
-
onRelease
protected void onRelease(E entry)
- Since:
- 4.3
-
onReuse
protected void onReuse(E entry)
- Since:
- 4.4
-
isShutdown
public boolean isShutdown()
-
shutdown
public void shutdown(long waitMs) throws java.io.IOException
- Throws:
java.io.IOException
-
lease
public java.util.concurrent.Future<E> lease(T route, java.lang.Object state, long connectTimeout, java.util.concurrent.TimeUnit timeUnit, org.apache.http.concurrent.FutureCallback<E> callback)
-
lease
public java.util.concurrent.Future<E> lease(T route, java.lang.Object state, long connectTimeout, long leaseTimeout, java.util.concurrent.TimeUnit timeUnit, org.apache.http.concurrent.FutureCallback<E> callback)
- Since:
- 4.3
-
lease
public java.util.concurrent.Future<E> lease(T route, java.lang.Object state, org.apache.http.concurrent.FutureCallback<E> callback)
-
release
public void release(E entry, boolean reusable)
-
validatePendingRequests
public void validatePendingRequests()
-
requestCompleted
protected void requestCompleted(SessionRequest request)
-
requestCancelled
protected void requestCancelled(SessionRequest request)
-
requestFailed
protected void requestFailed(SessionRequest request)
-
requestTimeout
protected void requestTimeout(SessionRequest request)
-
setMaxTotal
public void setMaxTotal(int max)
- Specified by:
setMaxTotal
in interfaceorg.apache.http.pool.ConnPoolControl<T>
-
getMaxTotal
public int getMaxTotal()
- Specified by:
getMaxTotal
in interfaceorg.apache.http.pool.ConnPoolControl<T>
-
setDefaultMaxPerRoute
public void setDefaultMaxPerRoute(int max)
- Specified by:
setDefaultMaxPerRoute
in interfaceorg.apache.http.pool.ConnPoolControl<T>
-
getDefaultMaxPerRoute
public int getDefaultMaxPerRoute()
- Specified by:
getDefaultMaxPerRoute
in interfaceorg.apache.http.pool.ConnPoolControl<T>
-
setMaxPerRoute
public void setMaxPerRoute(T route, int max)
- Specified by:
setMaxPerRoute
in interfaceorg.apache.http.pool.ConnPoolControl<T>
-
getMaxPerRoute
public int getMaxPerRoute(T route)
- Specified by:
getMaxPerRoute
in interfaceorg.apache.http.pool.ConnPoolControl<T>
-
getTotalStats
public org.apache.http.pool.PoolStats getTotalStats()
- Specified by:
getTotalStats
in interfaceorg.apache.http.pool.ConnPoolControl<T>
-
getStats
public org.apache.http.pool.PoolStats getStats(T route)
- Specified by:
getStats
in interfaceorg.apache.http.pool.ConnPoolControl<T>
-
getRoutes
public java.util.Set<T> getRoutes()
Returns snapshot of all knows routes- Since:
- 4.4
-
enumAvailable
protected void enumAvailable(org.apache.http.pool.PoolEntryCallback<T,C> callback)
Enumerates all available connections.- Since:
- 4.3
-
enumLeased
protected void enumLeased(org.apache.http.pool.PoolEntryCallback<T,C> callback)
Enumerates all leased connections.- Since:
- 4.3
-
enumEntries
@Deprecated protected void enumEntries(java.util.Iterator<E> it, org.apache.http.pool.PoolEntryCallback<T,C> callback)
Deprecated.(4.3.2)
-
closeIdle
public void closeIdle(long idletime, java.util.concurrent.TimeUnit timeUnit)
-
closeExpired
public void closeExpired()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-