APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.net.http

pack-priv Class Http2ClientImpl

extends Object
Class Inheritance
Imports
java.io.IOException, .UncheckedIOException, java.util.Base64, .HashSet, .Map, .Set, java.util.concurrent.ConcurrentHashMap, .CompletableFuture, java.util.concurrent.locks.ReentrantLock, jdk.internal.net.http.common.Logger, .MinimalFuture, .Utils, jdk.internal.net.http.frame.SettingsFrame

Http2 specific aspects of HttpClientImpl

Field Summary

Modifier and TypeField and Description
private final HttpClientImpl
private final ReentrantLock
private final Map<String, Http2Connection>
pack-priv static final Logger
private final Set<String>
private static final int
K

private volatile boolean

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv HttpClientImpl
private boolean
pack-priv SettingsFrame
getClientSettings(boolean defaultServerPush)

pack-priv CompletableFuture<Http2Connection>
getConnectionFor(HttpRequestImpl req, Exchange<?> exchange)

When HTTP/2 requested only.

pack-priv int
private static int
getParameter(String property, int min, int max, int defaultValue)

pack-priv String
getSettingsString(boolean defaultServerPush)

Returns the client settings as a base64 (url) encoded string

pack-priv boolean
pack-priv void
removeFromPool(Http2Connection
the connection to remove from the pool
c
)

Removes the connection from the pool (if it was in the pool).

pack-priv boolean

Returns:

true if pushes are globally disabled on all connections
serverPushDisabled
()

This method is used to test whether pushes are globally disabled on all connections.

pack-priv void
stop()

public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clientback to summary
private final HttpClientImpl client
connectionPoolLockback to summary
private final ReentrantLock connectionPoolLock
connectionsback to summary
private final Map<String, Http2Connection> connections
debugback to summary
pack-priv static final Logger debug
failuresback to summary
private final Set<String> failures
Kback to summary
private static final int K
stoppingback to summary
private volatile boolean stopping

Constructor Detail

Http2ClientImplback to summary
pack-priv Http2ClientImpl(HttpClientImpl client)

Method Detail

clientback to summary
pack-priv HttpClientImpl client()
closeback to summary
private boolean close(Http2Connection h2c)
getClientSettingsback to summary
pack-priv SettingsFrame getClientSettings(boolean defaultServerPush)
getConnectionForback to summary
pack-priv CompletableFuture<Http2Connection> getConnectionFor(HttpRequestImpl req, Exchange<?> exchange)

When HTTP/2 requested only. The following describes the aggregate behavior including the calling code. In all cases, the HTTP/2 connection cache is checked first for a suitable connection and that is returned if available. If not, a new connection is opened, except in https case when a previous negotiate failed. In that case, we want to continue using http/1.1. When a connection is to be opened and if multiple requests are sent in parallel then each will open a new connection. If negotiation/upgrade succeeds then one connection will be put in the cache and the others will be closed after the initial request completes (not strictly necessary for h2, only for h2c) If negotiate/upgrade fails, then any opened connections remain open (as http/1.1) and will be used and cached in the http/1 cache. Note, this method handles the https failure case only (by completing the CF with an ALPN exception, handled externally) The h2c upgrade is handled externally also. Specific CF behavior of this method. 1. completes with ALPN exception: h2 negotiate failed for first time. failure recorded. 2. completes with other exception: failure not recorded. Caller must handle 3. completes normally with null: no connection in cache for h2c or h2 failed previously 4. completes normally with connection: h2 or h2c connection in cache. Use it.

getConnectionWindowSizeback to summary
pack-priv int getConnectionWindowSize(SettingsFrame clientSettings)
getParameterback to summary
private static int getParameter(String property, int min, int max, int defaultValue)
getSettingsStringback to summary
pack-priv String getSettingsString(boolean defaultServerPush)

Returns the client settings as a base64 (url) encoded string

offerConnectionback to summary
pack-priv boolean offerConnection(Http2Connection c)
removeFromPoolback to summary
pack-priv void removeFromPool(Http2Connection c)

Removes the connection from the pool (if it was in the pool). This method doesn't close the connection.

Parameters
c:Http2Connection

the connection to remove from the pool

serverPushDisabledback to summary
pack-priv boolean serverPushDisabled()

This method is used to test whether pushes are globally disabled on all connections.

Returns:boolean

true if pushes are globally disabled on all connections

stopback to summary
pack-priv void stop()
stoppingback to summary
public boolean stopping()