Http2StreamChannelBootstrap Class — netty Architecture
Architecture documentation for the Http2StreamChannelBootstrap class in Http2StreamChannelBootstrap.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 5a534d0f_a13f_a12d_bbed_309a0c8a2c40["Http2StreamChannelBootstrap"] c6e025d7_d341_a375_8bfc_ea721e4ca1e3["Http2StreamChannelBootstrap.java"] 5a534d0f_a13f_a12d_bbed_309a0c8a2c40 -->|defined in| c6e025d7_d341_a375_8bfc_ea721e4ca1e3 5f2cf5cf_ea0f_18a8_b659_6618a892614d["Http2StreamChannelBootstrap()"] 5a534d0f_a13f_a12d_bbed_309a0c8a2c40 -->|method| 5f2cf5cf_ea0f_18a8_b659_6618a892614d 547c7db1_3c83_2dd0_b5d8_838da93a7d18["open()"] 5a534d0f_a13f_a12d_bbed_309a0c8a2c40 -->|method| 547c7db1_3c83_2dd0_b5d8_838da93a7d18 f148f6d0_1caf_c90f_2345_593fac59337e["ChannelHandlerContext()"] 5a534d0f_a13f_a12d_bbed_309a0c8a2c40 -->|method| f148f6d0_1caf_c90f_2345_593fac59337e 172c38c6_af21_125c_acfb_43ad1a8f85fc["open0()"] 5a534d0f_a13f_a12d_bbed_309a0c8a2c40 -->|method| 172c38c6_af21_125c_acfb_43ad1a8f85fc 8d65137a_a1a3_5280_72d5_6353ad731305["init()"] 5a534d0f_a13f_a12d_bbed_309a0c8a2c40 -->|method| 8d65137a_a1a3_5280_72d5_6353ad731305 28eece98_007f_0096_486d_56423cd5640c["setChannelOptions()"] 5a534d0f_a13f_a12d_bbed_309a0c8a2c40 -->|method| 28eece98_007f_0096_486d_56423cd5640c b5b31856_ff44_86af_c7eb_7a34be4e312c["setChannelOption()"] 5a534d0f_a13f_a12d_bbed_309a0c8a2c40 -->|method| b5b31856_ff44_86af_c7eb_7a34be4e312c 43de7c05_2a84_498a_bd6c_b18dc8218d27["setAttributes()"] 5a534d0f_a13f_a12d_bbed_309a0c8a2c40 -->|method| 43de7c05_2a84_498a_bd6c_b18dc8218d27
Relationship Graph
Source Code
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelBootstrap.java lines 38–248
public final class Http2StreamChannelBootstrap {
private static final InternalLogger logger = InternalLoggerFactory.getInstance(Http2StreamChannelBootstrap.class);
@SuppressWarnings("unchecked")
private static final Map.Entry<ChannelOption<?>, Object>[] EMPTY_OPTION_ARRAY = new Map.Entry[0];
@SuppressWarnings("unchecked")
private static final Map.Entry<AttributeKey<?>, Object>[] EMPTY_ATTRIBUTE_ARRAY = new Map.Entry[0];
// The order in which ChannelOptions are applied is important they may depend on each other for validation
// purposes.
private final Map<ChannelOption<?>, Object> options = new LinkedHashMap<ChannelOption<?>, Object>();
private final Map<AttributeKey<?>, Object> attrs = new ConcurrentHashMap<AttributeKey<?>, Object>();
private final Channel channel;
private volatile ChannelHandler handler;
// Cache the ChannelHandlerContext to speed up open(...) operations.
private volatile ChannelHandlerContext multiplexCtx;
public Http2StreamChannelBootstrap(Channel channel) {
this.channel = ObjectUtil.checkNotNull(channel, "channel");
}
/**
* Allow to specify a {@link ChannelOption} which is used for the {@link Http2StreamChannel} instances once they got
* created. Use a value of {@code null} to remove a previous set {@link ChannelOption}.
*/
public <T> Http2StreamChannelBootstrap option(ChannelOption<T> option, T value) {
ObjectUtil.checkNotNull(option, "option");
synchronized (options) {
if (value == null) {
options.remove(option);
} else {
options.put(option, value);
}
}
return this;
}
/**
* Allow to specify an initial attribute of the newly created {@link Http2StreamChannel}. If the {@code value} is
* {@code null}, the attribute of the specified {@code key} is removed.
*/
public <T> Http2StreamChannelBootstrap attr(AttributeKey<T> key, T value) {
ObjectUtil.checkNotNull(key, "key");
if (value == null) {
attrs.remove(key);
} else {
attrs.put(key, value);
}
return this;
}
/**
* the {@link ChannelHandler} to use for serving the requests.
*/
public Http2StreamChannelBootstrap handler(ChannelHandler handler) {
this.handler = ObjectUtil.checkNotNull(handler, "handler");
return this;
}
/**
* Open a new {@link Http2StreamChannel} to use.
* @return the {@link Future} that will be notified once the channel was opened successfully or it failed.
*/
public Future<Http2StreamChannel> open() {
return open(channel.eventLoop().<Http2StreamChannel>newPromise());
}
/**
* Open a new {@link Http2StreamChannel} to use and notifies the given {@link Promise}.
* @return the {@link Future} that will be notified once the channel was opened successfully or it failed.
*/
public Future<Http2StreamChannel> open(final Promise<Http2StreamChannel> promise) {
try {
ChannelHandlerContext ctx = findCtx();
EventExecutor executor = ctx.executor();
if (executor.inEventLoop()) {
open0(ctx, promise);
} else {
final ChannelHandlerContext finalCtx = ctx;
executor.execute(new Runnable() {
Source
Frequently Asked Questions
What is the Http2StreamChannelBootstrap class?
Http2StreamChannelBootstrap is a class in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelBootstrap.java.
Where is Http2StreamChannelBootstrap defined?
Http2StreamChannelBootstrap is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelBootstrap.java at line 38.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free