org.apache.hc.client5.http.impl.nio

## Class H2SharingConnPool<T,C extends HttpConnection>

- java.lang.Object
- - org.apache.hc.client5.http.impl.nio.H2SharingConnPool<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 H2SharingConnPool<T,C extends HttpConnection>
    extends Object
    implements ManagedConnPool<T,C>

Experimental connections pool implementation that acts as a caching facade in front of a standard `ManagedConnPool` and shares already leased connections to multiplex message exchanges over active HTTP/2 connections.

Since:
  5.5

### Constructor Summary

Constructors
Constructor and Description
`H2SharingConnPool(ManagedConnPool<T,C> pool)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()`
`void` `close(CloseMode closeMode)`
`void` `closeExpired()`
`void` `closeIdle(TimeValue idleTime)`
`int` `getDefaultMaxPerRoute()`
`int` `getMaxPerRoute(T route)`
`int` `getMaxTotal()`
`Set<T>` `getRoutes()`
`PoolStats` `getStats(T route)`
`PoolStats` `getTotalStats()`
`Future<PoolEntry<T,C>>` `lease(T route, Object state, Timeout requestTimeout, FutureCallback<PoolEntry<T,C>> callback)`
`void` `release(PoolEntry<T,C> entry, boolean reusable)`
`void` `setDefaultMaxPerRoute(int max)`
`void` `setMaxPerRoute(T route, int max)`
`void` `setMaxTotal(int max)`
`String` `toString()`

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

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

### Constructor Detail

#### H2SharingConnPool

    public H2SharingConnPool(ManagedConnPool<T,C> pool)

### Method Detail

#### close

    public void close(CloseMode closeMode)

Specified by:
  `close` in interface `ModalCloseable`

#### close

    public void close()
               throws IOException

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

#### lease

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

Specified by:
  `lease` in interface `ConnPool<T,C extends HttpConnection>`

#### release

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

Specified by:
  `release` in interface `ConnPool<T,C extends HttpConnection>`

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

#### closeIdle

    public void closeIdle(TimeValue idleTime)

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

#### closeExpired

    public void closeExpired()

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

#### getRoutes

    public Set<T> getRoutes()

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

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`