@UnstableApi public interface Http2Connection
限定符和类型 | 接口和说明 |
---|---|
static interface |
Http2Connection.Endpoint<F extends Http2FlowController>
A view of the connection from one endpoint (local or remote).
|
static interface |
Http2Connection.Listener
Listener for life-cycle events for streams in this connection.
|
static interface |
Http2Connection.PropertyKey
A key to be used for associating application-defined properties with streams within this connection.
|
限定符和类型 | 方法和说明 |
---|---|
void |
addListener(Http2Connection.Listener listener)
Adds a listener of stream life-cycle events.
|
Future<java.lang.Void> |
close(Promise<java.lang.Void> promise)
Close this connection.
|
Http2Stream |
connectionStream()
Gets the stream object representing the connection, itself (i.e. stream zero).
|
Http2Stream |
forEachActiveStream(Http2StreamVisitor visitor)
Provide a means of iterating over the collection of active streams.
|
boolean |
goAwayReceived()
Indicates whether or not a
GOAWAY was received from the remote endpoint. |
void |
goAwayReceived(int lastKnownStream,
long errorCode,
ByteBuf message)
Indicates that a
GOAWAY was received from the remote endpoint and sets the last known stream. |
boolean |
goAwaySent()
Indicates whether or not a
GOAWAY was sent to the remote endpoint. |
boolean |
goAwaySent(int lastKnownStream,
long errorCode,
ByteBuf message)
Updates the local state of this
Http2Connection as a result of a GOAWAY to send to the remote
endpoint. |
boolean |
isServer()
Indicates whether or not the local endpoint for this connection is the server.
|
Http2Connection.Endpoint<Http2LocalFlowController> |
local()
Gets a view of this connection from the local
Http2Connection.Endpoint . |
Http2Connection.PropertyKey |
newKey()
Creates a new key that is unique within this
Http2Connection . |
int |
numActiveStreams()
Gets the number of streams that are actively in use (i.e.
|
Http2Connection.Endpoint<Http2RemoteFlowController> |
remote()
Gets a view of this connection from the remote
Http2Connection.Endpoint . |
void |
removeListener(Http2Connection.Listener listener)
Removes a listener of stream life-cycle events.
|
Http2Stream |
stream(int streamId)
Gets the stream if it exists.
|
boolean |
streamMayHaveExisted(int streamId)
Indicates whether or not the given stream may have existed within this connection.
|
Future<java.lang.Void> close(Promise<java.lang.Void> promise)
Note if iterating active streams via forEachActiveStream(Http2StreamVisitor)
and an exception is
thrown it is necessary to call this method again to ensure the close completes.
promise
- Will be completed when all streams have been removed, and listeners have been notified.Http2Connection.PropertyKey newKey()
Http2Connection
.void addListener(Http2Connection.Listener listener)
void removeListener(Http2Connection.Listener listener)
Http2Stream stream(int streamId)
null
.boolean streamMayHaveExisted(int streamId)
Http2Connection.Endpoint.mayHaveCreatedStream(int)
on both endpoints.Http2Stream connectionStream()
int numActiveStreams()
OPEN
or HALF CLOSED
).Http2Stream forEachActiveStream(Http2StreamVisitor visitor) throws Http2Exception
visitor
- The visitor which will visit each active stream.null
if iteration went past the end.Http2Exception
boolean isServer()
Http2Connection.Endpoint<Http2LocalFlowController> local()
Http2Connection.Endpoint
.Http2Connection.Endpoint<Http2RemoteFlowController> remote()
Http2Connection.Endpoint
.boolean goAwayReceived()
GOAWAY
was received from the remote endpoint.void goAwayReceived(int lastKnownStream, long errorCode, ByteBuf message) throws Http2Exception
GOAWAY
was received from the remote endpoint and sets the last known stream.lastKnownStream
- The Last-Stream-ID in the
GOAWAY frame.errorCode
- the Error Code in the
GOAWAY frame.message
- The Additional Debug Data in the
GOAWAY frame. Note that reference count ownership
belongs to the caller (ownership is not transferred to this method).Http2Exception
boolean goAwaySent()
GOAWAY
was sent to the remote endpoint.boolean goAwaySent(int lastKnownStream, long errorCode, ByteBuf message) throws Http2Exception
Http2Connection
as a result of a GOAWAY
to send to the remote
endpoint.lastKnownStream
- The Last-Stream-ID in the
GOAWAY frame.errorCode
- the Error Code in the
GOAWAY frame.
GOAWAY frame. Note that reference count ownership
belongs to the caller (ownership is not transferred to this method).true
if the corresponding GOAWAY
frame should be sent to the remote endpoint.Http2Exception