Http3ServerPushStreamManager Class — netty Architecture
Architecture documentation for the Http3ServerPushStreamManager class in Http3ServerPushStreamManager.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 603de3da_f437_97ed_be00_9d4c1ccef895["Http3ServerPushStreamManager"] 6480d5a9_89de_3908_c3c0_5d0856f85efc["Http3ServerPushStreamManager.java"] 603de3da_f437_97ed_be00_9d4c1ccef895 -->|defined in| 6480d5a9_89de_3908_c3c0_5d0856f85efc aea1eb1b_7782_c0dd_e4bf_a50fefc2ae9b["Http3ServerPushStreamManager()"] 603de3da_f437_97ed_be00_9d4c1ccef895 -->|method| aea1eb1b_7782_c0dd_e4bf_a50fefc2ae9b 5898268b_75de_f5d7_482e_c48e32ec86de["isPushAllowed()"] 603de3da_f437_97ed_be00_9d4c1ccef895 -->|method| 5898268b_75de_f5d7_482e_c48e32ec86de 76b16655_6205_147d_379d_2203d26c935a["reserveNextPushId()"] 603de3da_f437_97ed_be00_9d4c1ccef895 -->|method| 76b16655_6205_147d_379d_2203d26c935a e39f49b9_1f76_f606_3903_526e88267369["newPushStream()"] 603de3da_f437_97ed_be00_9d4c1ccef895 -->|method| e39f49b9_1f76_f606_3903_526e88267369 e8a2f850_231a_7f9e_97ea_563a77d0bc72["ChannelInboundHandler()"] 603de3da_f437_97ed_be00_9d4c1ccef895 -->|method| e8a2f850_231a_7f9e_97ea_563a77d0bc72 56e09850_1361_7bcc_3c80_1e0bbbb95af4["nextPushId()"] 603de3da_f437_97ed_be00_9d4c1ccef895 -->|method| 56e09850_1361_7bcc_3c80_1e0bbbb95af4 c880fcd2_60d5_80f4_523f_c5ad437a50c2["validatePushId()"] 603de3da_f437_97ed_be00_9d4c1ccef895 -->|method| c880fcd2_60d5_80f4_523f_c5ad437a50c2 d032286d_e614_a333_6fe6_f4f6d6c0c5c9["Http3PushStreamServerInitializer()"] 603de3da_f437_97ed_be00_9d4c1ccef895 -->|method| d032286d_e614_a333_6fe6_f4f6d6c0c5c9 e310e1cb_513a_082a_cdaa_ab9c5f6cb01f["setupCancelPushIfStreamCreationFails()"] 603de3da_f437_97ed_be00_9d4c1ccef895 -->|method| e310e1cb_513a_082a_cdaa_ab9c5f6cb01f f7f83c18_1172_f883_a999_7a89c74f22f0["sendCancelPushIfFailed()"] 603de3da_f437_97ed_be00_9d4c1ccef895 -->|method| f7f83c18_1172_f883_a999_7a89c74f22f0
Relationship Graph
Source Code
codec-http3/src/main/java/io/netty/handler/codec/http3/Http3ServerPushStreamManager.java lines 49–290
public final class Http3ServerPushStreamManager {
private static final AtomicLongFieldUpdater<Http3ServerPushStreamManager> nextIdUpdater =
newUpdater(Http3ServerPushStreamManager.class, "nextId");
private static final Object CANCELLED_STREAM = new Object();
private static final Object PUSH_ID_GENERATED = new Object();
private static final Object AWAITING_STREAM_ESTABLISHMENT = new Object();
private final QuicChannel channel;
private final ConcurrentMap<Long, Object> pushStreams;
private final ChannelInboundHandler controlStreamListener;
private volatile long nextId;
/**
* Creates a new instance.
*
* @param channel for which this manager is created.
*/
public Http3ServerPushStreamManager(QuicChannel channel) {
this(channel, 8);
}
/**
* Creates a new instance.
*
* @param channel for which this manager is created.
* @param initialPushStreamsCountHint a hint for the number of push streams that may be created.
*/
public Http3ServerPushStreamManager(QuicChannel channel, int initialPushStreamsCountHint) {
this.channel = requireNonNull(channel, "channel");
pushStreams = newConcurrentHashMap(initialPushStreamsCountHint);
controlStreamListener = new ChannelInboundHandlerAdapter() {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
if (msg instanceof Http3CancelPushFrame) {
final long pushId = ((Http3CancelPushFrame) msg).id();
if (pushId >= nextId) {
connectionError(ctx, H3_ID_ERROR, "CANCEL_PUSH id greater than the last known id", true);
return;
}
pushStreams.computeIfPresent(pushId, (id, existing) -> {
if (existing == AWAITING_STREAM_ESTABLISHMENT) {
return CANCELLED_STREAM;
}
if (existing == PUSH_ID_GENERATED) {
throw new IllegalStateException("Unexpected push stream state " + existing +
" for pushId: " + id);
}
assert existing instanceof QuicStreamChannel;
((QuicStreamChannel) existing).close();
// remove the push stream from the map.
return null;
});
}
ReferenceCountUtil.release(msg);
}
};
}
/**
* Returns {@code true} if server push is allowed at this point.
*
* @return {@code true} if server push is allowed at this point.
*/
public boolean isPushAllowed() {
return isPushAllowed(maxPushIdReceived(channel));
}
/**
* Reserves a push ID to be used to create a new push stream subsequently. A push ID can only be used to create
* exactly one push stream.
*
* @return Next push ID.
* @throws IllegalStateException If it is not allowed to create any more push streams on the associated
* {@link QuicChannel}. Use {@link #isPushAllowed()} to check if server push is allowed.
*/
public long reserveNextPushId() {
final long maxPushId = maxPushIdReceived(channel);
if (isPushAllowed(maxPushId)) {
return nextPushId();
Source
Frequently Asked Questions
What is the Http3ServerPushStreamManager class?
Http3ServerPushStreamManager is a class in the netty codebase, defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3ServerPushStreamManager.java.
Where is Http3ServerPushStreamManager defined?
Http3ServerPushStreamManager is defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3ServerPushStreamManager.java at line 49.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free