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

pack-priv final Class Http3ClientImpl

extends Object
implements AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable
Imports
java.io.IOException, java.net.InetSocketAddress, java.net.http.HttpOption.Http3DiscoveryMode, .UnsupportedProtocolVersionException, java.nio.channels.ClosedChannelException, java.util.ArrayList, .List, .Objects, .Optional, .Set, java.util.concurrent.CompletableFuture, .ConcurrentHashMap, .ConcurrentLinkedQueue, java.util.concurrent.atomic.AtomicReference, java.util.concurrent.locks.ReentrantLock, jdk.internal.net.http.AltServicesRegistry.AltService, jdk.internal.net.http.common.ConnectionExpiredException, .Log, .Logger, .MinimalFuture, .Utils, jdk.internal.net.http.http3.Http3Error, jdk.internal.net.http.quic.QuicClient, .QuicTransportParameters, jdk.internal.net.quic.QuicVersion, .QuicTLSContext

Http3 specific aspects of HttpClientImpl

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static interface
pack-priv static record
pack-priv static record
pack-priv static record

Field Summary

Modifier and TypeField and Description
private static final List<QuicVersion>
pack-priv final HttpClientImpl
private volatile boolean
private final Http3ConnectionPool
private final Logger
private static final boolean
private final AtomicReference<Throwable>
private final ReentrantLock
private final Set<String>
private final Set<Http3Connection>
private final QuicClient
private final Http3PendingConnections

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
pack-priv HttpClientImpl
public void
close()

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

private void
pack-priv void
private void
connectionCompleted(String connectionKey, Exchange<?> origExchange, Http3Connection conn, Throwable error)

private void
connectionCompleted0(String connectionKey, Exchange<?> origExchange, Http3Connection conn, Throwable error)

pack-priv String
pack-priv String
public Logger
private static String
describe(HttpRequestImpl request, long id)

private static String
describe(Exchange<?> exchange)

private static String
private static String
pack-priv Http3Connection
pack-priv CompletableFuture<Http3Connection>
pack-priv CompletableFuture<Http3Connection>
getConnectionFor(HttpRequestImpl request, Exchange<?> exchange, Http3ClientImpl.Waiter pendingWaiter)

public boolean

Returns:

true if the given authority is believed to not support h3
hasNoH3
(String
the raw authority (host:port)
rawAuthority
)

Tells whether the given authority has been marked as not supporting h3

private static String
pack-priv Optional<AltServicesRegistry.AltService>
public boolean

Returns:

true if there's no h3 endpoint already registered for the given uri.
mayAttemptDirectConnection
(HttpRequestImpl
the request that may go through h3
request
)

A direct HTTP/3 attempt may be attempted if we don't have an AltService h3 endpoint recorded for it, and if the given request URI's raw authority hasn't been marked as not supporting HTTP/3, and if the request discovery config is not ALT_SVC.

public void
noH3(String
the raw authority (host:port)
rawAuthority
)

After an unsuccessful H3 direct connection attempt, mark the authority as not supporting h3.

pack-priv Http3Connection
pack-priv QuicClient
pack-priv void
public void
stop()

public void
private CompletableFuture<Http3Connection>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

availableQuicVersionsback to summary
private static final List<QuicVersion> availableQuicVersions
clientback to summary
pack-priv final HttpClientImpl client
closedback to summary
private volatile boolean closed
connectionsback to summary
private final Http3ConnectionPool connections
debugback to summary
private final Logger debug
disableHostnameVerificationback to summary
private static final boolean disableHostnameVerification
errorRefback to summary
private final AtomicReference<Throwable> errorRef
lockback to summary
private final ReentrantLock lock
noH3back to summary
private final Set<String> noH3
pendingCloseback to summary
private final Set<Http3Connection> pendingClose
quicClientback to summary
private final QuicClient quicClient
reconnectionsback to summary
private final Http3PendingConnections reconnections

Constructor Detail

Http3ClientImplback to summary
pack-priv Http3ClientImpl(HttpClientImpl client)

Method Detail

abortback to summary
public void abort(Throwable t)
clientback to summary
pack-priv HttpClientImpl client()
closeback to summary
public void close()

Implements java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
completeWaiterback to summary
private void completeWaiter(Logger debug, Http3ClientImpl.Waiter pendingWaiter, Http3Connection r, Throwable t)
connectionClosedback to summary
pack-priv void connectionClosed(Http3Connection c)
connectionCompletedback to summary
private void connectionCompleted(String connectionKey, Exchange<?> origExchange, Http3Connection conn, Throwable error)
connectionCompleted0back to summary
private void connectionCompleted0(String connectionKey, Exchange<?> origExchange, Http3Connection conn, Throwable error)
connectionKeyback to summary
pack-priv String connectionKey(HttpRequestImpl request)
dbgStringback to summary
pack-priv String dbgString()
debugback to summary
public Logger debug()
describeback to summary
private static String describe(HttpRequestImpl request, long id)
describeback to summary
private static String describe(Exchange<?> exchange)
describeAltSvcback to summary
private static String describeAltSvc(Http3ClientImpl.PendingConnection pendingConnection)
describePendingExchangeback to summary
private static String describePendingExchange(String prefix, Http3ClientImpl.PendingConnection pending)
findPooledConnectionForback to summary
pack-priv Http3Connection findPooledConnectionFor(HttpRequestImpl request, Exchange<?> exchange) throws IOException
getConnectionForback to summary
pack-priv CompletableFuture<Http3Connection> getConnectionFor(HttpRequestImpl request, Exchange<?> exchange)
getConnectionForback to summary
pack-priv CompletableFuture<Http3Connection> getConnectionFor(HttpRequestImpl request, Exchange<?> exchange, Http3ClientImpl.Waiter pendingWaiter)
hasNoH3back to summary
public boolean hasNoH3(String rawAuthority)

Tells whether the given authority has been marked as not supporting h3

Parameters
rawAuthority:String

the raw authority (host:port)

Returns:boolean

true if the given authority is believed to not support h3

labelback to summary
private static String label(Http3Connection conn)
lookupAltSvcback to summary
pack-priv Optional<AltServicesRegistry.AltService> lookupAltSvc(HttpRequestImpl request)
mayAttemptDirectConnectionback to summary
public boolean mayAttemptDirectConnection(HttpRequestImpl request)

A direct HTTP/3 attempt may be attempted if we don't have an AltService h3 endpoint recorded for it, and if the given request URI's raw authority hasn't been marked as not supporting HTTP/3, and if the request discovery config is not ALT_SVC. Note that a URI may be marked has not supporting H3 if it doesn't acknowledge the first initial quic packet in the time defined by jdk.httpclient.http3.maxDirectConnectionTimeout.

Parameters
request:HttpRequestImpl

the request that may go through h3

Returns:boolean

true if there's no h3 endpoint already registered for the given uri.

noH3back to summary
public void noH3(String rawAuthority)

After an unsuccessful H3 direct connection attempt, mark the authority as not supporting h3.

Parameters
rawAuthority:String

the raw authority (host:port)

offerConnectionback to summary
pack-priv Http3Connection offerConnection(Http3Connection c)
quicClientback to summary
pack-priv QuicClient quicClient()
removeFromPoolback to summary
pack-priv void removeFromPool(Http3Connection c)
stopback to summary
public void stop()
streamLimitReachedback to summary
public void streamLimitReached(Http3Connection connection, HttpRequestImpl request)
wrapForDebugback to summary
private CompletableFuture<Http3Connection> wrapForDebug(CompletableFuture<Http3Connection> h3Cf, Exchange<?> exchange, HttpRequestImpl request)
jdk.internal.net.http back to summary

pack-priv sealed Interface Http3ClientImpl.ConnectionRecovery

permits PendingConnection, StreamLimitReached
Known Direct Implementers
jdk.internal.net.http.Http3ClientImpl.PendingConnection, jdk.internal.net.http.Http3ClientImpl.StreamLimitReached

jdk.internal.net.http back to summary

pack-priv final Record Http3ClientImpl.PendingConnection

extends Record
implements ConnectionRecovery
Class Inheritance
All Implemented Interfaces
jdk.internal.net.http.Http3ClientImpl.ConnectionRecovery
Record Components
altSvc:AltServicesRegistry.AltService 
exchange:Exchange<?> 
waiters:ConcurrentLinkedQueue<Http3ClientImpl.Waiter> 

Field Summary

Modifier and TypeField and Description
private final AltServicesRegistry.AltService
altSvc

Record Component accessed by altSvc().

private final Exchange<?>
exchange

Record Component accessed by exchange().

private final ConcurrentLinkedQueue<Http3ClientImpl.Waiter>
waiters

Record Component accessed by waiters().

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
public AltServicesRegistry.AltService
altSvc()

Record Component getter of altSvc.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public Exchange<?>
exchange()

Record Component getter of exchange.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public ConcurrentLinkedQueue<Http3ClientImpl.Waiter>
waiters()

Record Component getter of waiters.

Field Detail

altSvcback to summary
private final AltServicesRegistry.AltService altSvc

Record Component accessed by altSvc().

exchangeback to summary
private final Exchange<?> exchange

Record Component accessed by exchange().

waitersback to summary
private final ConcurrentLinkedQueue<Http3ClientImpl.Waiter> waiters

Record Component accessed by waiters().

Constructor Detail

PendingConnectionback to summary
pack-priv PendingConnection(AltServicesRegistry.AltService altSvc, Exchange<?> exchange, ConcurrentLinkedQueue<Http3ClientImpl.Waiter> waiters)
PendingConnectionback to summary
pack-priv PendingConnection(AltServicesRegistry.AltService altSvc, Exchange<?> exchange)

Method Detail

altSvcback to summary
public AltServicesRegistry.AltService altSvc()

Record Component getter of altSvc.

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
exchangeback to summary
public Exchange<?> exchange()

Record Component getter of exchange.

hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

waitersback to summary
public ConcurrentLinkedQueue<Http3ClientImpl.Waiter> waiters()

Record Component getter of waiters.

jdk.internal.net.http back to summary

pack-priv final Record Http3ClientImpl.StreamLimitReached

extends Record
implements ConnectionRecovery
Class Inheritance
All Implemented Interfaces
jdk.internal.net.http.Http3ClientImpl.ConnectionRecovery
Record Components
connection:Http3Connection 

Field Summary

Modifier and TypeField and Description
private final Http3Connection
connection

Record Component accessed by connection().

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Http3Connection
connection()

Record Component getter of connection.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

connectionback to summary
private final Http3Connection connection

Record Component accessed by connection().

Constructor Detail

StreamLimitReachedback to summary
pack-priv StreamLimitReached(Http3Connection connection)

Method Detail

connectionback to summary
public Http3Connection connection()

Record Component getter of connection.

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

jdk.internal.net.http back to summary

pack-priv final Record Http3ClientImpl.Waiter

extends Record
Class Inheritance
Record Components
cf:MinimalFuture<Http3Connection> 
request:HttpRequestImpl 
exchange:Exchange<?> 

Field Summary

Modifier and TypeField and Description
private final MinimalFuture<Http3Connection>
cf

Record Component accessed by cf().

private final Exchange<?>
exchange

Record Component accessed by exchange().

private final HttpRequestImpl
request

Record Component accessed by request().

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public MinimalFuture<Http3Connection>
cf()

Record Component getter of cf.

pack-priv void
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public Exchange<?>
exchange()

Record Component getter of exchange.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

pack-priv static Http3ClientImpl.Waiter
of(HttpRequestImpl request, Exchange<?> exchange)

public HttpRequestImpl
request()

Record Component getter of request.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

cfback to summary
private final MinimalFuture<Http3Connection> cf

Record Component accessed by cf().

exchangeback to summary
private final Exchange<?> exchange

Record Component accessed by exchange().

requestback to summary
private final HttpRequestImpl request

Record Component accessed by request().

Constructor Detail

Waiterback to summary
pack-priv Waiter(MinimalFuture<Http3Connection> cf, HttpRequestImpl request, Exchange<?> exchange)

Method Detail

cfback to summary
public MinimalFuture<Http3Connection> cf()

Record Component getter of cf.

completeback to summary
pack-priv void complete(Http3Connection conn, Throwable error)
equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
exchangeback to summary
public Exchange<?> exchange()

Record Component getter of exchange.

hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

ofback to summary
pack-priv static Http3ClientImpl.Waiter of(HttpRequestImpl request, Exchange<?> exchange)
requestback to summary
public HttpRequestImpl request()

Record Component getter of request.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.