Top Description Inners Fields Constructors Methods
io.netty5.handler.codec.http2

public Class DefaultHttp2Connection

extends Object
implements Http2Connection
Class Inheritance
All Implemented Interfaces
io.netty5.handler.codec.http2.Http2Connection
Annotations
@UnstableApi
Imports
io.netty5.buffer.Buffer, io.netty5.handler.codec.http2.Http2Stream.State, io.netty5.util.collection.IntObjectHashMap, .IntObjectMap, .IntObjectMap.PrimitiveEntry, io.netty5.util.concurrent.Promise, io.netty5.util.internal.EmptyArrays, .UnstableApi, io.netty5.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.util.ArrayDeque, .ArrayList, .Arrays, .Iterator, .LinkedHashSet, .List, .Queue, .Set

Simple implementation of Http2Connection.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
DefaultHttp2Connection.ActiveStreams

Manages the list of currently active streams.

private class
DefaultHttp2Connection.ConnectionStream

Stream class representing the connection, itself.

private class
DefaultHttp2Connection.DefaultEndpoint<F extends Http2FlowController>

Simple endpoint implementation.

pack-priv class
DefaultHttp2Connection.DefaultPropertyKey

Implementation of PropertyKey that specifies the index position of the property.

private class
DefaultHttp2Connection.DefaultStream

Simple stream implementation.

pack-priv static interface
DefaultHttp2Connection.Event

Allows events which would modify the collection of active streams to be queued while iterating via forEachActiveStream(Http2StreamVisitor).

private class
DefaultHttp2Connection.PropertyKeyRegistry

A registry of all stream property keys known by this connection.

Field Summary

Modifier and TypeField and Description
pack-priv final DefaultHttp2Connection.ActiveStreams
pack-priv Promise<Void>
pack-priv final DefaultHttp2Connection.ConnectionStream
pack-priv final List<Http2Connection.Listener>
listeners

We chose a List over a Set to avoid allocating an Iterator objects when iterating over the listeners.

pack-priv final DefaultHttp2Connection.DefaultEndpoint<Http2LocalFlowController>
private static final InternalLogger
pack-priv final DefaultHttp2Connection.PropertyKeyRegistry
pack-priv final DefaultHttp2Connection.DefaultEndpoint<Http2RemoteFlowController>
pack-priv final IntObjectMap<Http2Stream>

Constructor Summary

AccessConstructor and Description
public
DefaultHttp2Connection(boolean
whether or not this end-point is the server-side of the HTTP/2 connection.
server
)

Creates a new connection with the given settings.

public
DefaultHttp2Connection(boolean
whether or not this end-point is the server-side of the HTTP/2 connection.
server
,
int
The maximum amount of streams which can exist in the reserved state for each endpoint.
maxReservedStreams
)

Creates a new connection with the given settings.

Method Summary

Modifier and TypeMethod and Description
pack-priv static Http2Stream.State
activeState(int streamId, Http2Stream.State initialState, boolean isLocal, boolean halfClosed)

public void
addListener(Http2Connection.Listener listener)

Implements io.netty5.handler.codec.http2.Http2Connection.addListener.

Adds a listener of stream life-cycle events.
public void
close(final Promise<Void>
Will be completed when all streams have been removed, and listeners have been notified.
promise
)

Implements io.netty5.handler.codec.http2.Http2Connection.close.

Close this connection.
private void
public Http2Stream
connectionStream()

Implements io.netty5.handler.codec.http2.Http2Connection.connectionStream.

Gets the stream object representing the connection, itself (i.e. stream zero).
public Http2Stream
forEachActiveStream(Http2StreamVisitor
The visitor which will visit each active stream.
visitor
)

Implements io.netty5.handler.codec.http2.Http2Connection.forEachActiveStream.

Provide a means of iterating over the collection of active streams.
public boolean
goAwayReceived()

Implements io.netty5.handler.codec.http2.Http2Connection.goAwayReceived.

Indicates whether or not a GOAWAY was received from the remote endpoint.
public void
goAwayReceived(final int
The Last-Stream-ID in the GOAWAY frame.
lastKnownStream
,
long
the Error Code in the GOAWAY frame.
errorCode
,
Buffer
The Additional Debug Data in the GOAWAY frame. Note that reference count ownership belongs to the caller (ownership is not transferred to this method).
debugData
)

Implements io.netty5.handler.codec.http2.Http2Connection.goAwayReceived.

Indicates that a GOAWAY was received from the remote endpoint and sets the last known stream.
public boolean
goAwaySent()

Implements io.netty5.handler.codec.http2.Http2Connection.goAwaySent.

Indicates whether or not a GOAWAY was sent to the remote endpoint.
public boolean
goAwaySent(final int
The Last-Stream-ID in the GOAWAY frame.
lastKnownStream
,
long
the Error Code in the GOAWAY frame.
errorCode
,
Buffer
The Additional Debug Data in the GOAWAY frame. Note that reference count ownership belongs to the caller (ownership is not transferred to this method).
debugData
)

Implements io.netty5.handler.codec.http2.Http2Connection.goAwaySent.

Updates the local state of this Http2Connection as a result of a GOAWAY to send to the remote endpoint.
pack-priv final boolean
isClosed()

Determine if close(Promise) has been called and no more streams are allowed to be created.

public boolean
isServer()

Implements io.netty5.handler.codec.http2.Http2Connection.isServer.

Indicates whether or not the local endpoint for this connection is the server.
private boolean
isStreamMapEmpty()

Determine if streamMap only contains the connection stream.

public Http2Connection.Endpoint<Http2LocalFlowController>
local()

Implements io.netty5.handler.codec.http2.Http2Connection.local.

Gets a view of this connection from the local Endpoint.
public Http2Connection.PropertyKey
newKey()

Implements io.netty5.handler.codec.http2.Http2Connection.newKey.

Creates a new key that is unique within this Http2Connection.
pack-priv void
pack-priv void
public int
numActiveStreams()

Implements io.netty5.handler.codec.http2.Http2Connection.numActiveStreams.

Gets the number of streams that are actively in use (i.e. OPEN or HALF CLOSED).
public Http2Connection.Endpoint<Http2RemoteFlowController>
remote()

Implements io.netty5.handler.codec.http2.Http2Connection.remote.

Gets a view of this connection from the remote Endpoint.
public void
removeListener(Http2Connection.Listener listener)

Implements io.netty5.handler.codec.http2.Http2Connection.removeListener.

Removes a listener of stream life-cycle events.
pack-priv void
removeStream(DefaultHttp2Connection.DefaultStream
the stream to remove.
stream
,
Iterator<?>
an iterator that may be pointing to the stream during iteration and Iterator#remove() will be used if non-null.
itr
)

Remove a stream from the streamMap.

public Http2Stream
stream(int streamId)

Implements io.netty5.handler.codec.http2.Http2Connection.stream.

Gets the stream if it exists.
public boolean
streamMayHaveExisted(int streamId)

Implements io.netty5.handler.codec.http2.Http2Connection.streamMayHaveExisted.

Indicates whether or not the given stream may have existed within this connection.
pack-priv final DefaultHttp2Connection.DefaultPropertyKey
verifyKey(Http2Connection.PropertyKey key)

Verifies that the key is valid and returns it as the internal DefaultPropertyKey type.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait