## 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` - 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)`

Method Summary
`void` `closeExpired()`
`void` `closeIdle(long idletime, TimeUnit tunit)`
`protected abstract E` `createEntry(T route, C conn)`
`int` `getDefaultMaxPerRoute()`
`int` `getMaxPerRoute(T route)`
`int` `getMaxTotal()`
`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)` Attempts to lease a connection for the given route and with the given state from the pool.
`Future<E>` `lease(T route, Object state, long connectTimeout, TimeUnit tunit, FutureCallback<E> callback)`
`void` `release(E entry, boolean reusable)` Releases the pool entry back to the pool.
`protected void` `requestCancelled(SessionRequest request)`
`protected void` `requestCompleted(SessionRequest request)`
`protected void` `requestFailed(SessionRequest request)`
`protected void` `requestTimeout(SessionRequest request)`
`protected abstract SocketAddress` `resolveLocalAddress(T route)`
`protected abstract SocketAddress` `resolveRemoteAddress(T route)`
`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

    public AbstractNIOConnPool(ConnectingIOReactor ioreactor,
                               NIOConnFactory<T,C> connFactory,
                               int defaultMaxPerRoute,
                               int maxTotal)

Method Detail

### resolveRemoteAddress

    protected abstract SocketAddress resolveRemoteAddress(T route)

### resolveLocalAddress

    protected abstract SocketAddress resolveLocalAddress(T route)

### createEntry

    protected abstract E createEntry(T route,
                                     C conn)

### 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,
                           FutureCallback<E> 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<T,E extends PoolEntry<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 be `null`.
    `callback` - operation completion callback.
  Returns:
    future for a leased pool entry.

### lease

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

### release

    public void release(E entry,
                        boolean reusable)

  Description copied from interface: `ConnPool`
  Releases the pool entry back to the pool.

  Specified by:
    `release` in interface `ConnPool<T,E extends PoolEntry<T,C>>`
  Parameters:
    `entry` - pool entry leased from the pool
    `reusable` - flag indicating whether or not the released connection is in a consistent state and is safe for further use.

### 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>`

### closeIdle

    public void closeIdle(long idletime,
                          TimeUnit tunit)

### closeExpired

    public void closeExpired()

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.