Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

    @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
`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 timeUnit)`
`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)` 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, long leaseTimeout, TimeUnit timeUnit, FutureCallback<E> callback)`
`Future<E>` | `lease(T route, Object state, long connectTimeout, TimeUnit timeUnit, FutureCallback<E> callback)`
`protected void` | `onLease(E entry)`
`protected void` | `onRelease(E entry)`
`protected void` | `onReuse(E entry)`
`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 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 timeUnit,
                           FutureCallback<E> callback)

### lease

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

  Since:
    4.3

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

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

### closeExpired

    public void closeExpired()

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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