@UnstableApi public class Http2StreamChannelBootstrap extends java.lang.Object
Channel
.
The bootstrap requires a registered parent Channel
with a ChannelPipeline
that contains the
Http2MultiplexCodec
.
A child channel becomes active as soon as it is registered to an eventloop. Therefore, an active channel does not
map to an active HTTP/2 stream immediately. Only once a Http2HeadersFrame
has been sent or received, does
the channel map to an active HTTP/2 stream. In case it was not possible to open a new HTTP/2 stream (i.e. due to
the maximum number of active streams being exceeded), the child channel receives an exception indicating the reason
and is closed immediately thereafter.
This class is thread-safe.
Modifier and Type | Class and Description |
---|---|
private static class |
Http2StreamChannelBootstrap.ParentChannelAndMultiplexCodec |
Modifier and Type | Field and Description |
---|---|
private java.util.Map<AttributeKey<?>,java.lang.Object> |
attributes |
private Http2StreamChannelBootstrap.ParentChannelAndMultiplexCodec |
channelAndCodec |
private EventLoopGroup |
group |
private ChannelHandler |
handler |
private java.util.Map<ChannelOption<?>,java.lang.Object> |
options |
Constructor and Description |
---|
Http2StreamChannelBootstrap() |
Http2StreamChannelBootstrap(Http2StreamChannelBootstrap bootstrap0) |
Modifier and Type | Method and Description |
---|---|
<T> Http2StreamChannelBootstrap |
attr(AttributeKey<T> key,
T value)
Specify attributes with an initial value to be set on newly created channels.
|
java.util.Map<AttributeKey<?>,java.lang.Object> |
attributes() |
private static ChannelHandler |
checkSharable(ChannelHandler handler) |
ChannelFuture |
connect()
Creates a new channel that will eventually map to a local/outbound HTTP/2 stream.
|
(package private) ChannelFuture |
connect(int streamId)
Used by the
Http2MultiplexCodec to instantiate incoming/remotely-created streams. |
EventLoopGroup |
group() |
Http2StreamChannelBootstrap |
group(EventLoopGroup group)
Sets the
EventLoop to which channels created with this bootstrap are registered. |
ChannelHandler |
handler() |
Http2StreamChannelBootstrap |
handler(ChannelHandler handler)
Sets the channel handler that should be added to the channels's pipeline.
|
<T> Http2StreamChannelBootstrap |
option(ChannelOption<T> option,
T value)
Specify
ChannelOption s to be set on newly created channels. |
java.util.Map<ChannelOption<?>,java.lang.Object> |
options() |
Channel |
parentChannel() |
Http2StreamChannelBootstrap |
parentChannel(Channel parent)
Sets the parent channel that must have the
Http2MultiplexCodec in its pipeline. |
private void |
validateState() |
private volatile Http2StreamChannelBootstrap.ParentChannelAndMultiplexCodec channelAndCodec
private volatile ChannelHandler handler
private volatile EventLoopGroup group
private final java.util.Map<ChannelOption<?>,java.lang.Object> options
private final java.util.Map<AttributeKey<?>,java.lang.Object> attributes
public Http2StreamChannelBootstrap()
Http2StreamChannelBootstrap(Http2StreamChannelBootstrap bootstrap0)
public ChannelFuture connect()
ChannelFuture connect(int streamId)
Http2MultiplexCodec
to instantiate incoming/remotely-created streams.public Http2StreamChannelBootstrap parentChannel(Channel parent)
Http2MultiplexCodec
in its pipeline.parent
- a registered channel with the Http2MultiplexCodec
in its pipeline. This channel will
be the Channel.parent()
of all channels created via connect()
.this
public Http2StreamChannelBootstrap handler(ChannelHandler handler)
handler
- the channel handler to add to the channel's pipeline. The handler must be
ChannelHandler.Sharable
.this
public Http2StreamChannelBootstrap group(EventLoopGroup group)
EventLoop
to which channels created with this bootstrap are registered.group
- the eventloop or null
if the eventloop of the parent channel should be used.this
public <T> Http2StreamChannelBootstrap option(ChannelOption<T> option, T value)
ChannelOption
s to be set on newly created channels. An option can be removed by specifying a
value of null
.public <T> Http2StreamChannelBootstrap attr(AttributeKey<T> key, T value)
null
.public Channel parentChannel()
public ChannelHandler handler()
public EventLoopGroup group()
public java.util.Map<ChannelOption<?>,java.lang.Object> options()
public java.util.Map<AttributeKey<?>,java.lang.Object> attributes()
private void validateState()
private static ChannelHandler checkSharable(ChannelHandler handler)