org.apache.http.nio.pool
Class AbstractNIOConnPool<T,C,E extends PoolEntry<T,C>>

java.lang.Object
  extended by org.apache.http.nio.pool.AbstractNIOConnPool<T,C,E>
Type Parameters:
T - route
C - connection object
E - pool entry
All Implemented Interfaces:
ConnPool<T,E>, ConnPoolControl<T>
Direct Known Subclasses:
BasicNIOConnPool

@ThreadSafe
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
AbstractNIOConnPool(ConnectingIOReactor ioreactor, NIOConnFactory<T,C> connFactory, int defaultMaxPerRoute, int maxTotal)
          Deprecated. use AbstractNIOConnPool(ConnectingIOReactor, NIOConnFactory, SocketAddressResolver, int, int)
AbstractNIOConnPool(ConnectingIOReactor ioreactor, NIOConnFactory<T,C> connFactory, SocketAddressResolver<T> addressResolver, int defaultMaxPerRoute, int maxTotal)
           
 
Method Summary
 void closeExpired()
           
 void closeIdle(long idletime, TimeUnit tunit)
           
protected abstract  E createEntry(T route, C conn)
           
protected  void enumAvailable(PoolEntryCallback<T,C> callback)
          Enumerates all available connections.
protected  void enumEntries(Iterator<E> it, PoolEntryCallback<T,C> callback)
          Deprecated. (4.3.2)
protected  void enumLeased(PoolEntryCallback<T,C> callback)
          Enumerates all leased connections.
 int getDefaultMaxPerRoute()
           
 int getMaxPerRoute(T route)
           
 int getMaxTotal()
           
 Set<T> getRoutes()
          Returns snapshot of all knows routes
 PoolStats getStats(T route)
           
 PoolStats getTotalStats()
           
 boolean isShutdown()
           
 Future<E> lease(T route, Object state)
           
 Future<E> lease(T route, Object state, FutureCallback<E> callback)
           
 Future<E> lease(T route, Object state, long connectTimeout, long leaseTimeout, TimeUnit tunit, FutureCallback<E> callback)
           
 Future<E> lease(T route, Object state, long connectTimeout, TimeUnit tunit, 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  SocketAddress resolveLocalAddress(T route)
          Deprecated. (4.3) use SocketAddressResolver
protected  SocketAddress resolveRemoteAddress(T route)
          Deprecated. (4.3) use SocketAddressResolver
 void setDefaultMaxPerRoute(int max)
           
 void setMaxPerRoute(T route, int max)
           
 void setMaxTotal(int max)
           
 void shutdown(long waitMs)
           
 String toString()
           
 void validatePendingRequests()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractNIOConnPool

@Deprecated
public AbstractNIOConnPool(ConnectingIOReactor ioreactor,
                                      NIOConnFactory<T,C> connFactory,
                                      int defaultMaxPerRoute,
                                      int maxTotal)
Deprecated. use AbstractNIOConnPool(ConnectingIOReactor, NIOConnFactory, SocketAddressResolver, int, int)


AbstractNIOConnPool

public AbstractNIOConnPool(ConnectingIOReactor ioreactor,
                           NIOConnFactory<T,C> connFactory,
                           SocketAddressResolver<T> addressResolver,
                           int defaultMaxPerRoute,
                           int maxTotal)
Since:
4.3
Method Detail

resolveRemoteAddress

@Deprecated
protected SocketAddress resolveRemoteAddress(T route)
Deprecated. (4.3) use SocketAddressResolver


resolveLocalAddress

@Deprecated
protected SocketAddress resolveLocalAddress(T route)
Deprecated. (4.3) use SocketAddressResolver


createEntry

protected abstract E createEntry(T route,
                                 C conn)

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 IOException
Throws:
IOException

lease

public Future<E> lease(T route,
                       Object state,
                       long connectTimeout,
                       TimeUnit tunit,
                       FutureCallback<E> callback)

lease

public Future<E> lease(T route,
                       Object state,
                       long connectTimeout,
                       long leaseTimeout,
                       TimeUnit tunit,
                       FutureCallback<E> callback)
Since:
4.3

lease

public Future<E> lease(T route,
                       Object state,
                       FutureCallback<E> callback)
Specified by:
lease in interface ConnPool<T,E extends PoolEntry<T,C>>

lease

public Future<E> lease(T route,
                       Object state)

release

public void release(E entry,
                    boolean reusable)
Specified by:
release in interface ConnPool<T,E extends PoolEntry<T,C>>

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 interface ConnPoolControl<T>

getMaxTotal

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

setDefaultMaxPerRoute

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

getDefaultMaxPerRoute

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

setMaxPerRoute

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

getMaxPerRoute

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

getTotalStats

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

getStats

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

getRoutes

public Set<T> getRoutes()
Returns snapshot of all knows routes

Since:
4.4

enumAvailable

protected void enumAvailable(PoolEntryCallback<T,C> callback)
Enumerates all available connections.

Since:
4.3

enumLeased

protected void enumLeased(PoolEntryCallback<T,C> callback)
Enumerates all leased connections.

Since:
4.3

enumEntries

@Deprecated
protected void enumEntries(Iterator<E> it,
                                      PoolEntryCallback<T,C> callback)
Deprecated. (4.3.2)

Use enumLeased(org.apache.http.pool.PoolEntryCallback) or enumAvailable(org.apache.http.pool.PoolEntryCallback) instead.


closeIdle

public void closeIdle(long idletime,
                      TimeUnit tunit)

closeExpired

public void closeExpired()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2005–2015 The Apache Software Foundation. All rights reserved.