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

The following parameters can be used to customize the behavior of this class:

- `CoreProtocolPNames.HTTP_ELEMENT_CHARSET`
- `CoreConnectionPNames.SO_TIMEOUT`
- `CoreConnectionPNames.CONNECTION_TIMEOUT`
- `CoreConnectionPNames.SOCKET_BUFFER_SIZE`
- `CoreConnectionPNames.MAX_HEADER_COUNT`
- `CoreConnectionPNames.MAX_LINE_LENGTH`

Since:
  4.2
See Also:
  `HttpHost`

Constructor Summary
`BasicNIOConnPool(ConnectingIOReactor ioreactor, HttpParams params)`
`BasicNIOConnPool(ConnectingIOReactor ioreactor, NIOConnFactory<HttpHost,NHttpClientConnection> connFactory, HttpParams params)`

Method Summary
`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 SocketAddress` `resolveLocalAddress(HttpHost host)`
`protected SocketAddress` `resolveRemoteAddress(HttpHost host)`

Methods inherited from class org.apache.http.nio.pool.AbstractNIOConnPool
`closeExpired, closeIdle, getDefaultMaxPerRoute, getMaxPerRoute, getMaxTotal, getStats, getTotalStats, isShutdown, 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

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

### BasicNIOConnPool

    public BasicNIOConnPool(ConnectingIOReactor ioreactor,
                            HttpParams params)

Method Detail

### resolveRemoteAddress

    protected SocketAddress resolveRemoteAddress(HttpHost host)

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

### resolveLocalAddress

    protected SocketAddress resolveLocalAddress(HttpHost host)

  Specified by:
    `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>`

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