@UnstableApi public class DefaultHttp2Connection extends java.lang.Object implements Http2Connection
Http2Connection.Http2Connection.Endpoint<F extends Http2FlowController>, Http2Connection.Listener, Http2Connection.PropertyKey| 构造器和说明 |
|---|
DefaultHttp2Connection(boolean server)
Creates a new connection with the given settings.
|
DefaultHttp2Connection(boolean server,
int maxReservedStreams)
Creates a new connection with the given settings.
|
| 限定符和类型 | 方法和说明 |
|---|---|
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 debugData)
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 debugData)
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.
|
public DefaultHttp2Connection(boolean server)
server - whether or not this end-point is the server-side of the HTTP/2 connection.public DefaultHttp2Connection(boolean server,
int maxReservedStreams)
server - whether or not this end-point is the server-side of the HTTP/2 connection.maxReservedStreams - The maximum amount of streams which can exist in the reserved state for each endpoint.public Future<java.lang.Void> close(Promise<java.lang.Void> promise)
Http2ConnectionNote if iterating active streams via Http2Connection.forEachActiveStream(Http2StreamVisitor) and an exception is
thrown it is necessary to call this method again to ensure the close completes.
close 在接口中 Http2Connectionpromise - Will be completed when all streams have been removed, and listeners have been notified.public void addListener(Http2Connection.Listener listener)
Http2ConnectionaddListener 在接口中 Http2Connectionpublic void removeListener(Http2Connection.Listener listener)
Http2ConnectionremoveListener 在接口中 Http2Connectionpublic boolean isServer()
Http2ConnectionisServer 在接口中 Http2Connectionpublic Http2Stream connectionStream()
Http2ConnectionconnectionStream 在接口中 Http2Connectionpublic Http2Stream stream(int streamId)
Http2Connectionnull.stream 在接口中 Http2Connectionpublic boolean streamMayHaveExisted(int streamId)
Http2ConnectionHttp2Connection.Endpoint.mayHaveCreatedStream(int) on both endpoints.streamMayHaveExisted 在接口中 Http2Connectionpublic int numActiveStreams()
Http2ConnectionOPEN or HALF CLOSED).numActiveStreams 在接口中 Http2Connectionpublic Http2Stream forEachActiveStream(Http2StreamVisitor visitor) throws Http2Exception
Http2ConnectionforEachActiveStream 在接口中 Http2Connectionvisitor - The visitor which will visit each active stream.null if iteration went past the end.Http2Exceptionpublic Http2Connection.Endpoint<Http2LocalFlowController> local()
Http2ConnectionHttp2Connection.Endpoint.local 在接口中 Http2Connectionpublic Http2Connection.Endpoint<Http2RemoteFlowController> remote()
Http2ConnectionHttp2Connection.Endpoint.remote 在接口中 Http2Connectionpublic boolean goAwayReceived()
Http2ConnectionGOAWAY was received from the remote endpoint.goAwayReceived 在接口中 Http2Connectionpublic void goAwayReceived(int lastKnownStream,
long errorCode,
ByteBuf debugData)
throws Http2Exception
Http2ConnectionGOAWAY was received from the remote endpoint and sets the last known stream.goAwayReceived 在接口中 Http2ConnectionlastKnownStream - The Last-Stream-ID in the
GOAWAY frame.errorCode - the Error Code in the
GOAWAY frame.debugData - The Additional Debug Data in the
GOAWAY frame. Note that reference count ownership
belongs to the caller (ownership is not transferred to this method).Http2Exceptionpublic boolean goAwaySent()
Http2ConnectionGOAWAY was sent to the remote endpoint.goAwaySent 在接口中 Http2Connectionpublic boolean goAwaySent(int lastKnownStream,
long errorCode,
ByteBuf debugData)
throws Http2Exception
Http2ConnectionHttp2Connection as a result of a GOAWAY to send to the remote
endpoint.goAwaySent 在接口中 Http2ConnectionlastKnownStream - 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.Http2Exceptionpublic Http2Connection.PropertyKey newKey()
Http2ConnectionHttp2Connection.newKey 在接口中 Http2Connection