@Override
    public Future<PoolEntry<T, C>> lease(final T route,
                                         final Object state,
                                         final Timeout requestTimeout,
                                         final FutureCallback<PoolEntry<T, C>> callback) {
        Asserts.check(!closed.get(), "Connection pool shut down");
        if (state == null) {
            final PerRoutePool<T, C> perRoutePool = perRouteCache.get(route);
            if (perRoutePool != null) {
                final PoolEntry<T, C> entry = perRoutePool.lease();
                if (entry != null) {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug("Sharing connection {} for message exchange multiplexing (lease count = {})",
                                ConnPoolSupport.getId(entry.getConnection()), perRoutePool.getCount(entry));
                    }
                    final Future<PoolEntry<T, C>> future = new CompletedFuture<>(entry);
                    if (callback != null) {
                        callback.completed(entry);
                    }
                    return future;
                }
            }
        }
        LOG.debug("No shared connection available");
        return pool.lease(route,
                state,
                requestTimeout,
                new CallbackContribution<PoolEntry<T, C>>(callback) {

                    @Override
                    public void completed(final PoolEntry<T, C> entry) {
                        if (state == null) {
                            final C connection = entry.getConnection();
                            final ProtocolVersion ver = connection != null ? connection.getProtocolVersion() : null;
                            if (ver == HttpVersion.HTTP_2_0) {
                                final PerRoutePool<T, C> perRoutePool = getPerRoutePool(route);
                                final long count = perRoutePool.track(entry);
                                if (LOG.isDebugEnabled()) {
                                    LOG.debug("Connection {} can be shared for message exchange multiplexing (lease count = {})",
                                            ConnPoolSupport.getId(entry.getConnection()), count);
                                }
                            }
                        }
                        if (callback != null) {
                            callback.completed(entry);
                        }
                    }

                });
    }
Experimental connections pool implementation that acts as a caching facade in front of
a standard {@link ManagedConnPool} and shares already leased connections to multiplex
message exchanges over active HTTP/2 connections.
@param <T> route
@param <C> connection object

@since 5.5
httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/H2SharingConnPool.java