org.apache.http.impl.nio.pool

## Class BasicNIOConnPool

- java.lang.Object
- - org.apache.http.nio.pool.AbstractNIOConnPool<HttpHost,NHttpClientConnection,BasicNIOPoolEntry>
  - - org.apache.http.impl.nio.pool.BasicNIOConnPool

All Implemented Interfaces:
  ConnPool<HttpHost,BasicNIOPoolEntry>, ConnPoolControl<HttpHost>

    @ThreadSafe
    public class BasicNIOConnPool
    extends AbstractNIOConnPool<HttpHost,NHttpClientConnection,BasicNIOPoolEntry>

A very basic `ConnPool` implementation that represents a pool of non-blocking `NHttpClientConnection` connections identified by an `HttpHost` instance. Please note this pool implementation does not support complex routes via a proxy cannot differentiate between direct and proxied connections.

Since:
  4.2
See Also:
  `HttpHost`

### Constructor Summary

Constructors
Constructor and Description
`BasicNIOConnPool(ConnectingIOReactor ioreactor)`
`BasicNIOConnPool(ConnectingIOReactor ioreactor, ConnectionConfig config)`
`BasicNIOConnPool(ConnectingIOReactor ioreactor, HttpParams params)` Deprecated. (4.3) use `BasicNIOConnPool(ConnectingIOReactor, ConnectionConfig)`
`BasicNIOConnPool(ConnectingIOReactor ioreactor, int connectTimeout, ConnectionConfig config)`
`BasicNIOConnPool(ConnectingIOReactor ioreactor, NIOConnFactory<HttpHost,NHttpClientConnection> connFactory, HttpParams params)` Deprecated. (4.3) use `BasicNIOConnPool(ConnectingIOReactor, NIOConnFactory, int)`
`BasicNIOConnPool(ConnectingIOReactor ioreactor, NIOConnFactory<HttpHost,NHttpClientConnection> connFactory, int connectTimeout)`

### Method Summary

Methods
`protected BasicNIOPoolEntry` `createEntry(HttpHost host, NHttpClientConnection conn)`
`Future<BasicNIOPoolEntry>` `lease(HttpHost route, Object state)`
`Future<BasicNIOPoolEntry>` `lease(HttpHost route, Object state, FutureCallback<BasicNIOPoolEntry> callback)` Attempts to lease a connection for the given route and with the given state from the pool.
`protected void` `onLease(BasicNIOPoolEntry entry)`
`protected void` `onRelease(BasicNIOPoolEntry entry)`
`protected SocketAddress` `resolveLocalAddress(HttpHost host)` Deprecated. (4.3) use `SocketAddressResolver`
`protected SocketAddress` `resolveRemoteAddress(HttpHost host)` Deprecated. (4.3) use `SocketAddressResolver`

### Methods inherited from class org.apache.http.nio.pool.AbstractNIOConnPool

`closeExpired, closeIdle, enumAvailable, enumEntries, enumLeased, getDefaultMaxPerRoute, getMaxPerRoute, getMaxTotal, getStats, getTotalStats, isShutdown, lease, lease, release, requestCancelled, requestCompleted, requestFailed, requestTimeout, setDefaultMaxPerRoute, setMaxPerRoute, setMaxTotal, shutdown, toString, validatePendingRequests`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### BasicNIOConnPool

    @Deprecated
    public BasicNIOConnPool(ConnectingIOReactor ioreactor,
                               NIOConnFactory<HttpHost,NHttpClientConnection> connFactory,
                               HttpParams params)

Deprecated. (4.3) use `BasicNIOConnPool(ConnectingIOReactor, NIOConnFactory, int)`

#### BasicNIOConnPool

    @Deprecated
    public BasicNIOConnPool(ConnectingIOReactor ioreactor,
                               HttpParams params)

Deprecated. (4.3) use `BasicNIOConnPool(ConnectingIOReactor, ConnectionConfig)`

#### BasicNIOConnPool

    public BasicNIOConnPool(ConnectingIOReactor ioreactor,
                    NIOConnFactory<HttpHost,NHttpClientConnection> connFactory,
                    int connectTimeout)

Since:
  4.3

#### BasicNIOConnPool

    public BasicNIOConnPool(ConnectingIOReactor ioreactor,
                    int connectTimeout,
                    ConnectionConfig config)

Since:
  4.3

#### BasicNIOConnPool

    public BasicNIOConnPool(ConnectingIOReactor ioreactor,
                    ConnectionConfig config)

Since:
  4.3

#### BasicNIOConnPool

    public BasicNIOConnPool(ConnectingIOReactor ioreactor)

Since:
  4.3

### Method Detail

#### resolveRemoteAddress

    @Deprecated
    protected SocketAddress resolveRemoteAddress(HttpHost host)

Deprecated. (4.3) use `SocketAddressResolver`

Overrides:
  `resolveRemoteAddress` in class `AbstractNIOConnPool<HttpHost,NHttpClientConnection,BasicNIOPoolEntry>`

#### resolveLocalAddress

    @Deprecated
    protected SocketAddress resolveLocalAddress(HttpHost host)

Deprecated. (4.3) use `SocketAddressResolver`

Overrides:
  `resolveLocalAddress` in class `AbstractNIOConnPool<HttpHost,NHttpClientConnection,BasicNIOPoolEntry>`

#### createEntry

    protected BasicNIOPoolEntry createEntry(HttpHost host,
                                NHttpClientConnection conn)

Specified by:
  `createEntry` in class `AbstractNIOConnPool<HttpHost,NHttpClientConnection,BasicNIOPoolEntry>`

#### lease

    public Future<BasicNIOPoolEntry> lease(HttpHost route,
                                  Object state,
                                  FutureCallback<BasicNIOPoolEntry> 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<HttpHost,BasicNIOPoolEntry>`
Overrides:
  `lease` in class `AbstractNIOConnPool<HttpHost,NHttpClientConnection,BasicNIOPoolEntry>`
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<BasicNIOPoolEntry> lease(HttpHost route,
                                  Object state)

Overrides:
  `lease` in class `AbstractNIOConnPool<HttpHost,NHttpClientConnection,BasicNIOPoolEntry>`

#### onLease

    protected void onLease(BasicNIOPoolEntry entry)

Overrides:
  `onLease` in class `AbstractNIOConnPool<HttpHost,NHttpClientConnection,BasicNIOPoolEntry>`

#### onRelease

    protected void onRelease(BasicNIOPoolEntry entry)

Overrides:
  `onRelease` in class `AbstractNIOConnPool<HttpHost,NHttpClientConnection,BasicNIOPoolEntry>`