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

pack-priv final Class Http3ExchangeImpl<T>

extends Http3Stream<T>
Class Inheritance
Imports
java.io.EOFException, .IOException, java.lang.invoke.MethodHandles, .VarHandle, java.net.ProtocolException, java.net.http.HttpClient.Version, .HttpHeaders, .HttpRequest.BodyPublisher, .HttpResponse, .HttpResponse.BodyHandler, .HttpResponse.BodySubscriber, .HttpResponse.ResponseInfo, java.nio.ByteBuffer, java.nio.charset.StandardCharsets, java.util.ArrayList, .Collections, .List, .Map, .Optional, .Set, java.util.concurrent.CompletableFuture, .CompletionException, .ConcurrentHashMap, .ConcurrentLinkedQueue, .Executor, .Flow, .Flow.Subscription, java.util.concurrent.atomic.AtomicLong, .AtomicReference, java.util.concurrent.locks.ReentrantLock, java.util.function.BiPredicate, jdk.internal.net.http.PushGroup.Acceptor, jdk.internal.net.http.common.HttpBodySubscriberWrapper, .HttpHeadersBuilder, .Log, .Logger, .MinimalFuture, .SequentialScheduler, .SubscriptionBase, .Utils, .ValidatingHeadersConsumer, jdk.internal.net.http.http3.ConnectionSettings, .Http3Error, jdk.internal.net.http.http3.frames.DataFrame, .FramesDecoder, .HeadersFrame, .PushPromiseFrame, jdk.internal.net.http.qpack.Decoder, .DecodingCallback, .Encoder, .QPackException, jdk.internal.net.http.qpack.readers.HeaderFrameReader, jdk.internal.net.http.qpack.writers.HeaderFrameWriter, jdk.internal.net.http.quic.streams.QuicBidiStream, .QuicStreamReader, .QuicStreamWriter

This class represents an HTTP/3 Request/Response stream.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
pack-priv class
private class
pack-priv static record
pack-priv class

Field Summary

Modifier and TypeField and Description
pack-priv volatile boolean
private final Http3Connection
private String
private final Logger
pack-priv volatile boolean
private static final VarHandle
private final AtomicReference<Throwable>
private final H3FrameOrderVerifier
private final FramesDecoder
private final HeaderFrameReader
private final HeaderFrameWriter
pack-priv volatile HttpResponse.BodySubscriber<T>
pack-priv final ConcurrentHashMap<PushPromiseFrame, Http3ExchangeImpl.PushPromiseState>
private final Decoder
private final Encoder
private final QuicStreamReader
private final SequentialScheduler
private final HttpRequestImpl
private final CompletableFuture<Void>
pack-priv volatile long
private final HttpHeaders
private final HttpRequest.BodyPublisher
pack-priv volatile boolean
pack-priv volatile Http3ExchangeImpl<T>.RequestSubscriber
pack-priv volatile Response
private final List<CompletableFuture<Response>>
private final ReentrantLock
pack-priv volatile CompletableFuture<T>
pack-priv volatile int
private final HttpHeadersBuilder
pack-priv volatile boolean
pack-priv volatile HttpResponse.BodySubscriber<T>
private final Http3ExchangeImpl<T>.HeadersConsumer
private final AtomicLong
private final ReentrantLock
pack-priv volatile boolean
private final QuicBidiStream
pack-priv final SubscriptionBase
private final QuicStreamWriter
private final SequentialScheduler
Inherited from jdk.internal.net.http.Http3Stream:
responseData

Constructor Summary

AccessConstructor and Description
pack-priv
Http3ExchangeImpl(final Http3Connection connection, final Exchange<T> exchange, final QuicBidiStream stream)

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean
pack-priv PushGroup.Acceptor<T>

Returns:

an Acceptor to get the body handler for the push request, or null.
acceptPushPromise
(long
the pushId
pushId
,
HttpRequestImpl
the promised push request
pushRequest
)

This method is called by the Http3PushManager in order to invoke the Acceptor that will accept the push promise.

pack-priv void
cancel()

Implements abstract jdk.internal.net.http.ExchangeImpl.cancel.

Cancels a request.

pack-priv void
cancel(IOException cause)

Implements abstract jdk.internal.net.http.ExchangeImpl.cancel.

Cancels a request with a cause.

private void
cancel(Flow.Subscription subscription)

pack-priv void
cancelImpl(Throwable e, Http3Error error)

Implements abstract jdk.internal.net.http.Http3Stream.cancelImpl.

Cancel the stream exchange on error

private void
pack-priv void
pack-priv void
closeAsUnprocessed()

An unprocessed exchange is one that hasn't been processed by a peer.

pack-priv void
completed()

Implements abstract jdk.internal.net.http.ExchangeImpl.completed.

Called when the exchange is completed, so that cleanup actions may be performed - such as deregistering callbacks.

pack-priv void
completeResponse(Response resp)

Implements abstract jdk.internal.net.http.Http3Stream.completeResponse.

Completes the first uncompleted CF on list, and removes it.

pack-priv void
private static long
computeHeaderSize(final HttpHeaders... headers)

pack-priv HttpQuicConnection
connection()

Implements abstract jdk.internal.net.http.ExchangeImpl.connection.

Returns the HttpConnection instance to which this exchange is assigned.

pack-priv void
connectionError(Throwable throwable, long errorCode, String errMsg)

Implements abstract jdk.internal.net.http.Http3Stream.connectionError.

Notify of a connection error.

pack-priv Http3ExchangeImpl<T>.Http3StreamResponseSubscriber<T>
pack-priv String
pack-priv boolean
pack-priv void
private HttpHeaders
pack-priv Throwable
getCancelCause()

Implements abstract jdk.internal.net.http.ExchangeImpl.getCancelCause.

Returns the cause for which this exchange was canceled, if available.

pack-priv CompletableFuture<Response>
getResponseAsync(Executor executor)

Implements abstract jdk.internal.net.http.ExchangeImpl.getResponseAsync.

Gets the response headers.

protected void
protected void
private static boolean
pack-priv Http3Connection
pack-priv CompletableFuture<Void>
ignoreBody()

Implements abstract jdk.internal.net.http.ExchangeImpl.ignoreBody.

Ignore/consume the body.

private void
private boolean
pack-priv boolean
isCanceled()

Implements abstract jdk.internal.net.http.ExchangeImpl.isCanceled.

Returns true if this exchange was canceled.

private static boolean
pack-priv Response
newResponse(HttpHeaders responseHeaders, int responseCode)

Implements abstract jdk.internal.net.http.Http3Stream.newResponse.

Called to create a new Response object for the newly receive response headers and response status code.

pack-priv void
pack-priv void
onHttp3PushStreamStarted(HttpRequestImpl
the pushRequest
pushRequest
,
Http3PushPromiseStream<T>
the pushStream
pushStream
)

This method is called by the Http3PushPromiseStream when starting

pack-priv void
onPollException(QuicStreamReader reader, IOException io)

Implements abstract jdk.internal.net.http.Http3Stream.onPollException.

Called when an exception is thrown by reader::poll when called from processQuicData.

pack-priv void
onProtocolError(IOException cause)

Implements abstract jdk.internal.net.http.ExchangeImpl.onProtocolError.

Invoked whenever there is a (HTTP) protocol error when dealing with the response from the server.

pack-priv void
onPushRequestAccepted(long
the pushId
pushId
,
CompletableFuture<HttpResponse<T>>
the response completable future
responseCF
)

This method is called by the Http3PushManager once the responseCF has been obtained from the acceptor.

pack-priv void
onReaderReset()

Implements abstract jdk.internal.net.http.Http3Stream.onReaderReset.

Called when processQuicData detects that the reader has been reset.

pack-priv void
private void
pack-priv void
pushResponseData(ConcurrentLinkedQueue<List<ByteBuffer>> responseData)

Implements abstract jdk.internal.net.http.Http3Stream.pushResponseData.

Push response data to the response body subscriber if allowed by the subscription state.

pack-priv CompletableFuture<T>
readBodyAsync(HttpResponse.BodyHandler<T> handler, boolean returnConnectionToPool, Executor executor)

Implements abstract jdk.internal.net.http.ExchangeImpl.readBodyAsync.

pack-priv void
receiveHeaders(HeadersFrame headers, List<ByteBuffer> payload)

Implements abstract jdk.internal.net.http.Http3Stream.receiveHeaders.

Called when new payload data is received by processQuicData for a given header frame.

pack-priv void
receivePushPromiseFrame(PushPromiseFrame ppf, List<ByteBuffer> payload)

Implements abstract jdk.internal.net.http.Http3Stream.receivePushPromiseFrame.

Called when new payload data is received by processQuicData for a given push promise frame.

pack-priv CompletableFuture<T>
pack-priv void
recordError(Throwable closeCause)

private void
pack-priv void
released()

Implements abstract jdk.internal.net.http.ExchangeImpl.released.

Called when the exchange is released, so that cleanup actions may be performed - such as deregistering callbacks.

pack-priv void
private void
pack-priv void
private void
pack-priv CompletableFuture<ExchangeImpl<T>>
sendBodyAsync()

Implements abstract jdk.internal.net.http.ExchangeImpl.sendBodyAsync.

Sends a request body, after request headers have been sent.

pack-priv CompletableFuture<Void>
private Http3ExchangeImpl<T>
pack-priv CompletableFuture<ExchangeImpl<T>>
private void
public void
pack-priv long
streamId()

Implements abstract jdk.internal.net.http.Http3Stream.streamId.

Returns the Quic stream id for this exchange (request/response or push response).

private void
Inherited from jdk.internal.net.http.Http3Stream:
checkInterimResponseCountExceededconnectionErrorhandleResponseprocessQuicDatareadingPausedreceivedQuicBytesswitchReadingPaused