org.apache.hc.core5.pool

## Class LaxConnPool<T,C extends ModalCloseable>

- java.lang.Object
- - org.apache.hc.core5.pool.LaxConnPool<T,C>

- Type Parameters:
    `T` - route
    `C` - connection object
  All Implemented Interfaces:
    Closeable, AutoCloseable, ModalCloseable, ConnPool<T,C>, ConnPoolControl<T>, ConnPoolStats<T>, ManagedConnPool<T,C>

      @Contract(threading=SAFE)
       @Experimental
      public class LaxConnPool<T,C extends ModalCloseable>
      extends Object
      implements ManagedConnPool<T,C>

  Connection pool with higher concurrency but with lax connection limit guarantees.
  Since:
    5.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LaxConnPool(int defaultMaxPerRoute)`
    `LaxConnPool(int defaultMaxPerRoute, TimeValue timeToLive, PoolReusePolicy policy, ConnPoolListener<T> connPoolListener)`
    `LaxConnPool(int defaultMaxPerRoute, TimeValue timeToLive, PoolReusePolicy policy, DisposalCallback<C> disposalCallback, ConnPoolListener<T> connPoolListener)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `void` | `close(CloseMode closeMode)` Closes this process or endpoint and releases any system resources associated with it.
    `void` | `closeExpired()`
    `void` | `closeIdle(TimeValue idleTime)`
    `void` | `enumAvailable(Callback<PoolEntry<T,C>> callback)`
    `void` | `enumLeased(Callback<PoolEntry<T,C>> callback)`
    `int` | `getDefaultMaxPerRoute()`
    `int` | `getMaxPerRoute(T route)`
    `int` | `getMaxTotal()`
    `Set<T>` | `getRoutes()`
    `PoolStats` | `getStats(T route)`
    `PoolStats` | `getTotalStats()`
    `boolean` | `isShutdown()`
    `Future<PoolEntry<T,C>>` | `lease(T route, Object state)`
    `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.
    `void` | `setDefaultMaxPerRoute(int max)`
    `void` | `setMaxPerRoute(T route, int max)`
    `void` | `setMaxTotal(int max)`
    `String` | `toString()`
    `void` | `validatePendingRequests()`

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

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

- - ### Constructor Detail

    - #### LaxConnPool

          public LaxConnPool(int defaultMaxPerRoute,
                             TimeValue timeToLive,
                             PoolReusePolicy policy,
                             DisposalCallback<C> disposalCallback,
                             ConnPoolListener<T> connPoolListener)

      Since:
        5.0

    - #### LaxConnPool

          public LaxConnPool(int defaultMaxPerRoute,
                             TimeValue timeToLive,
                             PoolReusePolicy policy,
                             ConnPoolListener<T> connPoolListener)

      Since:
        5.0

    - #### LaxConnPool

          public LaxConnPool(int defaultMaxPerRoute)

  - ### Method Detail

    - #### isShutdown

          public boolean isShutdown()

    - #### close

          public void close(CloseMode closeMode)

      Description copied from interface: `ModalCloseable`
      Closes this process or endpoint and releases any system resources associated with it. If the endpoint or the process is already closed then invoking this method has no effect.
      Specified by:
        `close` in interface `ModalCloseable`
      Parameters:
        `closeMode` - How to close the receiver.

    - #### close

          public void close()

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`

    - #### lease

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

      Description copied from interface: `ConnPool`
      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.

      Specified by:
        `lease` in interface `ConnPool<T,C extends ModalCloseable>`
      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.

    - #### lease

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

    - #### release

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

      Description copied from interface: `ConnPool`
      Releases the pool entry back to the pool.
      Specified by:
        `release` in interface `ConnPool<T,C extends ModalCloseable>`
      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()

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

    - #### getStats

          public PoolStats getStats(T route)

      Specified by:
        `getStats` in interface `ConnPoolStats<T>`

    - #### getRoutes

          public Set<T> getRoutes()

      Specified by:
        `getRoutes` in interface `ConnPoolControl<T>`

    - #### enumAvailable

          public void enumAvailable(Callback<PoolEntry<T,C>> callback)

    - #### enumLeased

          public void enumLeased(Callback<PoolEntry<T,C>> callback)

    - #### closeIdle

          public void closeIdle(TimeValue idleTime)

      Specified by:
        `closeIdle` in interface `ConnPoolControl<T>`

    - #### closeExpired

          public void closeExpired()

      Specified by:
        `closeExpired` in interface `ConnPoolControl<T>`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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