This class maintains a bounded collection of recent push promises,
together with the current state of the promise: pending, processed, or
cancelled. When a new jdk.
is received, and entry is added in the map, and the state of the promise
is updated as it goes.
When the map is full, old entries (lowest pushId) are expunged from
the map. No promise will be accepted if its pushId is lower than the
lowest pushId in the map.
API Note
When a PushPromiseFrame is received, onPushPromiseFrame(Http3ExchangeImpl, long, HttpHeaders)
is called. This arranges for an entry to be added to the map, unless there's
already one. Also, the first Http3ExchangeImpl for which this method is called
for a given pushId gets to handle the PushPromise: its java. will be invoked to accept the promise
and handle the body.
When a new PushStream is opened, onPushPromiseStream(QuicReceiverStream, long)
is called. When both onPushPromiseFrame and onPushPromiseStream have
been called for a given pushId, an Http3PushPromiseStream is created
and started to receive the body.
Http3ExchangeImpl that receive a push promise frame, but don't get to handle
the body (because it's already been delegated to another stream) should call
whenAccepted(long) to figure out when it is safe to invoke PushGroup#acceptPushPromiseId(PushId).
cancelPushPromise(long, Throwable, CancelPushReason) can be called to cancel
a push promise. pushPromiseProcessed(long) should be called when the body
has been fully processed.
| Modifier and Type | Class and Description |
|---|---|
| private static record | Http3PushManager.
Represent a PushPromise that has been cancelled. |
| pack-priv static enum | |
| private static class | Http3PushManager.
the type of the body T>Represents a PushPromise whose body has not been delivered yet. |
| private static record | Http3PushManager.
Represent a PushPromise whose body as already been delivered |
| private static interface | Http3PushManager.
A PushPromise can be a PendingPushPromise, until the push response is completely received, or a ProcessedPushPromise, which replace the PendingPushPromise after the response body has been delivered. |
| Modifier and Type | Field and Description |
|---|---|
| private final CompletableFuture | |
| private final Http3Connection | |
| private final Logger | |
| private final CompletableFuture | |
| private static final long | |
| private static final long | |
| private final AtomicLong | |
| private final AtomicLong | |
| private final AtomicLong | |
| private final AtomicInteger | |
| private final ReentrantLock | |
| private final ConcurrentHashMap | |
| private volatile boolean |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private <U> Http3PushManager. | |
| private <U> Http3PushManager. | |
| public void | |
| private void | |
| pack-priv void | cancelPushPromise(long
the promise pushId pushId, Throwable the cause (can be null) cause, Http3PushManager.reason for cancelling reasonCancel a push promise. |
| private void | |
| pack-priv IOException | Returns: anIOException that can be used to complete a completable
future if the maximum pushId is exceeded, null
otherwisethe pushId pushId)Checks whether the given pushId exceed the maximum pushId allowed to the peer, and if so, closes the connection. |
| pack-priv void | |
| private <U> Http3PushPromiseStream | |
| pack-priv String | |
| pack-priv long | Returns: the maximum pushId that can be accepted from the peerReturns the maximum pushId that can be accepted from the peer. |
| pack-priv long | Returns: the minimum pushId that can be accepted from the peerReturns the minimum pushId that can be accepted from the peer. |
| pack-priv <U> boolean | Returns: true if the exchange should take care of creating the HttpResponse body, false otherwiseThe HTTP/3 exchange that received the frame exchange, long The pushId contained in the frame pushId, HttpHeaders The push promise headers contained in the frame promiseHeaders)Called when a PushPromiseFrame has been decoded. |
| pack-priv void | onPushPromiseStream(QuicReceiverStream
the new push promise stream pushStream, long the pushId pushId)Called when a new push promise stream is created by the peer, and the pushId has been read. |
| pack-priv void | pushPromiseProcessed(long
the pushId pushId)Called when a push promise response body has been successfully received. |
| private <U> void | |
| pack-priv CompletableFuture | Returns: a completable future that will be completed when a pushId has been accepted by the exchange in charge of creating the response bodythe pushId pushId)Returns a completable future that will be completed when a pushId has been accepted by the exchange in charge of creating the response body. |
| ACCEPTED | back to summary |
|---|---|
| private final CompletableFuture<Boolean> ACCEPTED | |
| connection | back to summary |
|---|---|
| private final Http3Connection connection | |
| debug | back to summary |
|---|---|
| private final Logger debug | |
| DENIED | back to summary |
|---|---|
| private final CompletableFuture<Boolean> DENIED | |
| MAX_PUSH_HISTORY_SIZE | back to summary |
|---|---|
| private static final long MAX_PUSH_HISTORY_SIZE | |
| MAX_PUSH_ID_INCREMENTS | back to summary |
|---|---|
| private static final long MAX_PUSH_ID_INCREMENTS | |
| maxPushId | back to summary |
|---|---|
| private final AtomicLong maxPushId | |
| maxPushReceived | back to summary |
|---|---|
| private final AtomicLong maxPushReceived | |
| minPushId | back to summary |
|---|---|
| private final AtomicLong minPushId | |
| pendingPromises | back to summary |
|---|---|
| private final AtomicInteger pendingPromises | |
| promiseLock | back to summary |
|---|---|
| private final ReentrantLock promiseLock | |
| promises | back to summary |
|---|---|
| private final ConcurrentHashMap<Long, Http3PushManager. | |
| pushPromisesBlocked | back to summary |
|---|---|
| private volatile boolean pushPromisesBlocked | |
| Http3PushManager | back to summary |
|---|---|
| pack-priv Http3PushManager(Http3Connection connection) | |
| addPushPromise | back to summary |
|---|---|
| private <U> Http3PushManager. | |
| addPushPromise | back to summary |
|---|---|
| private <U> Http3PushManager. | |
| cancelAllPromises | back to summary |
|---|---|
| public void cancelAllPromises(IOException closeCause, Http3Error error) | |
| cancelPendingPushPromise | back to summary |
|---|---|
| private void cancelPendingPushPromise(Http3PushManager. | |
| cancelPushPromise | back to summary |
|---|---|
| pack-priv void cancelPushPromise(long pushId, Throwable cause, Http3PushManager. Cancel a push promise. In case of concurrent requests receiving the same pushId, where one has a PushPromiseHandler and the other doesn't, we will cancel the push only if reason != CANCEL_RECEIVED, or no request stream has already accepted the push.
| |
| checkExpungePromiseMap | back to summary |
|---|---|
| private void checkExpungePromiseMap() | |
| checkMaxPushId | back to summary |
|---|---|
| pack-priv IOException checkMaxPushId(long pushId) Checks whether the given pushId exceed the maximum pushId allowed to the peer, and if so, closes the connection.
| |
| checkSendMaxPushId | back to summary |
|---|---|
| pack-priv void checkSendMaxPushId() Checks whether a MAX_PUSH_ID frame needs to be sent,
and send it.
Called from | |
| createPushExchange | back to summary |
|---|---|
| private <U> Http3PushPromiseStream | |
| dbgTag | back to summary |
|---|---|
| pack-priv String dbgTag() | |
| getMaxPushId | back to summary |
|---|---|
| pack-priv long getMaxPushId() Returns the maximum pushId that can be accepted from the peer. This corresponds to the pushId that has been included in the last MAX_PUSH_ID frame sent to the peer. A pushId greater than this value must be rejected, and cause the connection to close with error. API Note due to internal constraints it is possible that the
MAX_PUSH_ID frame has not been sent yet, but the
| |
| getMinPushId | back to summary |
|---|---|
| pack-priv long getMinPushId() Returns the minimum pushId that can be accepted from the peer. Any pushId strictly less than this value must be ignored. API Note The minimum pushId represents the smallest pushId that was recorded in our history. For smaller pushId, no history has been kept, due to history size constraints. Any pushId strictly less than this value must be ignored.
| |
| onPushPromiseFrame | back to summary |
|---|---|
| pack-priv <U> boolean onPushPromiseFrame(Http3ExchangeImpl<U> exchange, long pushId, HttpHeaders promiseHeaders) throws IOException Called when a PushPromiseFrame has been decoded. API Note This method calls
| |
| onPushPromiseStream | back to summary |
|---|---|
| pack-priv void onPushPromiseStream(QuicReceiverStream pushStream, long pushId) Called when a new push promise stream is created by the peer, and the pushId has been read.
| |
| pushPromiseProcessed | back to summary |
|---|---|
| pack-priv void pushPromiseProcessed(long pushId) Called when a push promise response body has been successfully received.
| |
| tryReceivePromise | back to summary |
|---|---|
| private <U> void tryReceivePromise(Http3PushManager. | |
| whenAccepted | back to summary |
|---|---|
| pack-priv CompletableFuture Returns a completable future that will be completed when a pushId has been
accepted by the exchange in charge of creating the response body.
The completable future is complete with
| |
| Modifier and Type | Field and Description |
|---|---|
| private final HttpResponse. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | equals(Object o)
Implements abstract java. Indicates whether some other object is "equal to" this one. |
| public final int | |
| public HttpResponse. | |
| public final String | toString()
Implements abstract java. Returns a string representation of the record. |
| pushId | back to summary |
|---|---|
| private final HttpResponse. Record Component accessed by pushId(). | |
| CancelledPushPromise | back to summary |
|---|---|
| private CancelledPushPromise(HttpResponse. | |
| equals | back to summary |
|---|---|
| public final boolean equals(Object o) Implements abstract java. Doc from java. Indicates whether some other object is "equal to" this one. In addition
to the general contract of
R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
| |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Implements abstract java. Doc from java. Returns a hash code value for the record.
Obeys the general contract of | |
| pushId | back to summary |
|---|---|
| public HttpResponse. Record Component getter of pushId. | |
| toString | back to summary |
|---|---|
| public final String toString() Implements abstract java. Doc from java. Returns a string representation of the record.
In accordance with the general contract of 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. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final Http3PushManager. | |
| public static final Http3PushManager. | |
| public static final Http3PushManager. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Http3PushManager. | |
| public static Http3PushManager. |
| CANCEL_RECEIVED | back to summary |
|---|---|
| public static final Http3PushManager. | |
| NO_HANDLER | back to summary |
|---|---|
| public static final Http3PushManager. | |
| PUSH_CANCELLED | back to summary |
|---|---|
| public static final Http3PushManager. | |
| CancelPushReason | back to summary |
|---|---|
| private CancelPushReason() | |
| valueOf | back to summary |
|---|---|
| public static Http3PushManager. | |
| values | back to summary |
|---|---|
| public static Http3PushManager. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final CompletableFuture | |
| pack-priv Http3ExchangeImpl | |
| pack-priv HttpResponse. | |
| pack-priv HttpHeaders | |
| pack-priv Http3PushPromiseStream | |
| pack-priv final long | |
| pack-priv HttpRequestImpl | |
| pack-priv CompletableFuture | |
| pack-priv QuicReceiverStream |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv String | |
| pack-priv String | |
| public long | |
| public boolean | |
| public String |
| accepted | back to summary |
|---|---|
| pack-priv final CompletableFuture<Boolean> accepted | |
| exchange | back to summary |
|---|---|
| pack-priv Http3ExchangeImpl<T> exchange | |
| handler | back to summary |
|---|---|
| pack-priv HttpResponse. | |
| promiseHeaders | back to summary |
|---|---|
| pack-priv HttpHeaders promiseHeaders | |
| promiseStream | back to summary |
|---|---|
| pack-priv Http3PushPromiseStream<T> promiseStream | |
| pushId | back to summary |
|---|---|
| pack-priv final long pushId | |
| pushReq | back to summary |
|---|---|
| pack-priv HttpRequestImpl pushReq | |
| responseCF | back to summary |
|---|---|
| pack-priv CompletableFuture<HttpResponse<T>> responseCF | |
| stream | back to summary |
|---|---|
| pack-priv QuicReceiverStream stream | |
| PendingPushPromise | back to summary |
|---|---|
| pack-priv PendingPushPromise(Http3ExchangeImpl<T> exchange, long pushId, HttpHeaders promiseHeaders) | |
| PendingPushPromise | back to summary |
|---|---|
| pack-priv PendingPushPromise(QuicReceiverStream stream, long pushId) | |
| dbgTag | back to summary |
|---|---|
| pack-priv String dbgTag(Http3ExchangeImpl<?> exchange) | |
| dbgTag | back to summary |
|---|---|
| pack-priv String dbgTag(Http3PushPromiseStream<?> promiseStream) | |
| pushId | back to summary |
|---|---|
| public long pushId() | |
| ready | back to summary |
|---|---|
| public boolean ready() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| Modifier and Type | Field and Description |
|---|---|
| private final HttpHeaders | promiseHeaders
Record Component accessed by promiseHeaders(). |
| private final HttpResponse. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | equals(Object o)
Implements abstract java. Indicates whether some other object is "equal to" this one. |
| public final int | |
| public HttpHeaders | |
| public HttpResponse. | |
| public final String | toString()
Implements abstract java. Returns a string representation of the record. |
| promiseHeaders | back to summary |
|---|---|
| private final HttpHeaders promiseHeaders Record Component accessed by promiseHeaders(). | |
| pushId | back to summary |
|---|---|
| private final HttpResponse. Record Component accessed by pushId(). | |
| ProcessedPushPromise | back to summary |
|---|---|
| private ProcessedPushPromise(HttpResponse. | |
| equals | back to summary |
|---|---|
| public final boolean equals(Object o) Implements abstract java. Doc from java. Indicates whether some other object is "equal to" this one. In addition
to the general contract of
R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
| |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Implements abstract java. Doc from java. Returns a hash code value for the record.
Obeys the general contract of | |
| promiseHeaders | back to summary |
|---|---|
| public HttpHeaders promiseHeaders() Record Component getter of promiseHeaders. | |
| pushId | back to summary |
|---|---|
| public HttpResponse. Record Component getter of pushId. | |
| toString | back to summary |
|---|---|
| public final String toString() Implements abstract java. Doc from java. Returns a string representation of the record.
In accordance with the general contract of 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. | |