org.apache.hc.core5.pool

## Interface ConnPool<T,C extends ModalCloseable>

- Type Parameters:
    `T` - the route type that represents the opposite endpoint of a pooled connection.
    `C` - the type of pooled connections.
  All Known Subinterfaces:
    ManagedConnPool<T,C>
  All Known Implementing Classes:
    LaxConnPool, StrictConnPool

      public interface ConnPool<T,C extends ModalCloseable>

  `ConnPool` represents a shared pool connections can be leased from and released back to.
  Since:
    4.2

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Future<PoolEntry<T,C>>` | `lease(T route, Object state, Timeout requestTimeout, FutureCallback<PoolEntry<T,C>> callback)` Attempts to lease a connection for the given route and with the given state from the pool.
    `void` | `release(PoolEntry<T,C> entry, boolean reusable)` Releases the pool entry back to the pool.

- - ### Method Detail

    - #### lease

          Future<PoolEntry<T,C>> lease(T route,
                                       Object state,
                                       Timeout requestTimeout,
                                       FutureCallback<PoolEntry<T,C>> callback)

      Attempts to lease a connection for the given route and with the given state from the pool.

      Please note the connection request can get automatically cancelled by the pool in case of a request timeout.

      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`.
        `requestTimeout` - request timeout. In case of a timeout the request can get automatically cancelled by the pool.
        `callback` - operation completion callback.
      Returns:
        future for a leased pool entry.

    - #### release

          void release(PoolEntry<T,C> entry,
                       boolean reusable)

      Releases the pool entry back to the pool.
      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.

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