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

pack-priv final Class Exchange<T>

extends Object
Class Inheritance
Imports
java.io.IOException, java.net.ProtocolException, java.time.Duration, java.util.Optional, java.util.concurrent.CompletableFuture, .TimeUnit, java.util.concurrent.atomic.AtomicInteger, .AtomicReference, java.util.function.Function, java.net.http.HttpClient, .HttpResponse, .HttpTimeoutException, jdk.internal.net.http.HttpClientImpl.DelegatingExecutor, jdk.internal.net.http.common.Logger, .MinimalFuture, .Utils, .Log

One request/response exchange (handles 100/101 intermediate response also). depth field used to track number of times a new request is being sent for a given API request. If limit exceeded exception is thrown.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
pack-priv volatile CompletableFuture<Void>
pack-priv final HttpClientImpl
pack-priv final Exchange<T>.ConnectionAborter
pack-priv final String
pack-priv final Logger
pack-priv volatile CompletableFuture<? extends ExchangeImpl<T>>
pack-priv volatile ExchangeImpl<T>
private final AtomicReference<IOException>
pack-priv static final int
pack-priv final MultiExchange<T>
pack-priv final AtomicInteger
pack-priv final HttpClientImpl.DelegatingExecutor
pack-priv final PushGroup<T>
pack-priv final HttpRequestImpl
pack-priv volatile boolean
private volatile boolean
pack-priv volatile boolean
pack-priv volatile boolean

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
public void
private void
pack-priv <U> CompletableFuture<U>
private CompletableFuture<Response>
private CompletableFuture<Response>
pack-priv HttpClientImpl
pack-priv String
private CompletableFuture<? extends ExchangeImpl<T>>
pack-priv HttpClientImpl.DelegatingExecutor
private CompletableFuture<Response>
pack-priv synchronized IOException
pack-priv synchronized IOException
pack-priv PushGroup<T>
pack-priv String
public void
public boolean
private CompletableFuture<Response>

Returns:

A CompletableFuture with the final response from the server
ignore1xxResponse
(final Response
The response
rsp
)

Checks whether the passed Response has a status code between 102 and 199 (both inclusive).

public CompletableFuture<Void>
ignoreBody()

Called after a redirect or similar kind of retry where a body might be sent but we don't want it.

pack-priv HttpResponse.BodySubscriber<T>
pack-priv final boolean
pack-priv final void
pack-priv void
pack-priv boolean
public CompletableFuture<T>
public void
released()

Called when a new exchange is created to replace this exchange.

public Optional<Duration>
public HttpRequestImpl
public CompletableFuture<Response>
pack-priv CompletableFuture<Response>
private CompletableFuture<Response>
private CompletableFuture<Response>
pack-priv void
streamLimitReached(boolean streamLimitReached)

pack-priv HttpClient.Version
private CompletableFuture<Response>
private CompletableFuture<Response>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bodyIgnoredback to summary
pack-priv volatile CompletableFuture<Void> bodyIgnored
clientback to summary
pack-priv final HttpClientImpl client
connectionAborterback to summary
pack-priv final Exchange<T>.ConnectionAborter connectionAborter
dbgTagback to summary
pack-priv final String dbgTag
debugback to summary
pack-priv final Logger debug
exchangeCFback to summary
pack-priv volatile CompletableFuture<? extends ExchangeImpl<T>> exchangeCF
exchImplback to summary
pack-priv volatile ExchangeImpl<T> exchImpl
failedback to summary
private final AtomicReference<IOException> failed
MAX_NON_FINAL_RESPONSESback to summary
pack-priv static final int MAX_NON_FINAL_RESPONSES
multiback to summary
pack-priv final MultiExchange<T> multi
nonFinalResponsesback to summary
pack-priv final AtomicInteger nonFinalResponses
parentExecutorback to summary
pack-priv final HttpClientImpl.DelegatingExecutor parentExecutor
pushGroupback to summary
pack-priv final PushGroup<T> pushGroup
requestback to summary
pack-priv final HttpRequestImpl request
streamLimitReachedback to summary
pack-priv volatile boolean streamLimitReached
unprocessedByPeerback to summary
private volatile boolean unprocessedByPeer
upgradedback to summary
pack-priv volatile boolean upgraded
upgradingback to summary
pack-priv volatile boolean upgrading

Constructor Detail

Exchangeback to summary
pack-priv Exchange(HttpRequestImpl request, MultiExchange<T> multi)

Method Detail

cancelback to summary
public void cancel()
cancelback to summary
public void cancel(IOException cause)
checkCancelledback to summary
private void checkCancelled()
checkCancelledback to summary
pack-priv <U> CompletableFuture<U> checkCancelled(CompletableFuture<U> cf, HttpConnection connection)
checkFor407back to summary
private CompletableFuture<Response> checkFor407(ExchangeImpl<T> ex, Throwable t, Function<ExchangeImpl<T>, CompletableFuture<Response>> andThen)
checkForUpgradeAsyncback to summary
private CompletableFuture<Response> checkForUpgradeAsync(Response resp, ExchangeImpl<T> ex)
clientback to summary
pack-priv HttpClientImpl client()
dbgStringback to summary
pack-priv String dbgString()
establishExchangeback to summary
private CompletableFuture<? extends ExchangeImpl<T>> establishExchange(HttpConnection connection)
executorback to summary
pack-priv HttpClientImpl.DelegatingExecutor executor()
expectContinueback to summary
private CompletableFuture<Response> expectContinue(ExchangeImpl<T> ex)
failedback to summary
pack-priv synchronized IOException failed(IOException io)
getCancelCauseback to summary
pack-priv synchronized IOException getCancelCause()
getPushGroupback to summary
pack-priv PushGroup<T> getPushGroup()
h2cSettingsStringsback to summary
pack-priv String h2cSettingsStrings()
h2Upgradeback to summary
public void h2Upgrade()
hasReachedStreamLimitback to summary
public boolean hasReachedStreamLimit()
ignore1xxResponseback to summary
private CompletableFuture<Response> ignore1xxResponse(final Response rsp)

Checks whether the passed Response has a status code between 102 and 199 (both inclusive). If so, then that Response is considered intermediate informational response and is ignored by the client. This method then creates a new CompletableFuture which completes when a subsequent response is sent by the server. Such newly constructed CompletableFuture will not complete till a "final" response (one which doesn't have a response code between 102 and 199 inclusive) is sent by the server. The returned CompletableFuture is thus capable of handling multiple subsequent intermediate informational responses from the server.

If the passed Response doesn't have a status code between 102 and 199 (both inclusive) then this method immediately returns back a completed CompletableFuture with the passed Response.

Parameters
rsp:Response

The response

Returns:CompletableFuture<Response>

A CompletableFuture with the final response from the server

ignoreBodyback to summary
public CompletableFuture<Void> ignoreBody()

Called after a redirect or similar kind of retry where a body might be sent but we don't want it. Should send a RESET in h2. For http/1.1 we can consume small quantity of data, or close the connection in other cases.

ignoreBodyback to summary
pack-priv HttpResponse.BodySubscriber<T> ignoreBody(HttpResponse.ResponseInfo hdrs)
isUnprocessedByPeerback to summary
pack-priv final boolean isUnprocessedByPeer()
markUnprocessedByPeerback to summary
pack-priv final void markUnprocessedByPeer()
nullBodyback to summary
pack-priv void nullBody(HttpResponse<T> resp, Throwable t)
pushEnabledback to summary
pack-priv boolean pushEnabled()
readBodyAsyncback to summary
public CompletableFuture<T> readBodyAsync(HttpResponse.BodyHandler<T> handler)
releasedback to summary
public void released()

Called when a new exchange is created to replace this exchange. At this point it is guaranteed that readBody/readBodyAsync will not be called.

remainingConnectTimeoutback to summary
public Optional<Duration> remainingConnectTimeout()
requestback to summary
public HttpRequestImpl request()
responseAsyncback to summary
public CompletableFuture<Response> responseAsync()
responseAsyncImplback to summary
pack-priv CompletableFuture<Response> responseAsyncImpl(HttpConnection connection)
sendRequestBodyback to summary
private CompletableFuture<Response> sendRequestBody(ExchangeImpl<T> ex)
startSendingBodyback to summary
private CompletableFuture<Response> startSendingBody(HttpClientImpl.DelegatingExecutor executor)
streamLimitReachedback to summary
pack-priv void streamLimitReached(boolean streamLimitReached)
versionback to summary
pack-priv HttpClient.Version version()
wrapForLogback to summary
private CompletableFuture<Response> wrapForLog(CompletableFuture<Response> cf)
wrapForUpgradeback to summary
private CompletableFuture<Response> wrapForUpgrade(CompletableFuture<Response> cf)
jdk.internal.net.http back to summary

pack-priv final Class Exchange.ConnectionAborter

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private volatile Throwable
private volatile boolean
private volatile HttpConnection
private volatile HttpQuicConnection

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
clear(HttpConnection connection)

pack-priv void
private void
pack-priv void
pack-priv HttpConnection
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

causeback to summary
private volatile Throwable cause
closeRequestedback to summary
private volatile boolean closeRequested
connectionback to summary
private volatile HttpConnection connection
quicConnectionback to summary
private volatile HttpQuicConnection quicConnection

Constructor Detail

ConnectionAborterback to summary
pack-priv ConnectionAborter()

Method Detail

clearback to summary
pack-priv void clear(HttpConnection connection)
closeConnectionback to summary
pack-priv void closeConnection(Throwable error)
closeConnectionback to summary
private void closeConnection(HttpConnection connection, Throwable cause)
connectionback to summary
pack-priv void connection(HttpConnection connection)
disableback to summary
pack-priv HttpConnection disable()