Package io.netty.handler.codec.http2
Interface Http2Connection.Endpoint<F extends Http2FlowController>
-
- Enclosing interface:
- Http2Connection
public static interface Http2Connection.Endpoint<F extends Http2FlowController>A view of the connection from one endpoint (local or remote).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanallowPushTo()This is the SETTINGS_ENABLE_PUSH value sent from the opposite endpoint.voidallowPushTo(boolean allow)This is the SETTINGS_ENABLE_PUSH value sent from the opposite endpoint.booleancanOpenStream()Indicates whether or a stream created by this endpoint can be opened without violatingmaxActiveStreams().booleancreated(Http2Stream stream)Indicates whether or not this endpoint created the given stream.Http2StreamcreateStream(int streamId, boolean halfClosed)Creates a stream initiated by this endpoint.FflowController()Gets the flow controller for this endpoint.voidflowController(F flowController)Sets the flow controller for this endpoint.intincrementAndGetNextStreamId()Increment and get the next generated stream id this endpoint.booleanisServer()Indicates whether or not this endpoint is the server-side of the connection.booleanisValidStreamId(int streamId)Indicates whether the given streamId is from the set of IDs used by this endpoint to create new streams.intlastStreamCreated()Gets the ID of the stream last successfully created by this endpoint.intlastStreamKnownByPeer()If a GOAWAY was received for this endpoint, this will be the last stream ID from the GOAWAY frame.intmaxActiveStreams()Gets the maximum number of streams (created by this endpoint) that are allowed to be active at the same time.voidmaxActiveStreams(int maxActiveStreams)Sets the limit forSETTINGS_MAX_CONCURRENT_STREAMS.booleanmayHaveCreatedStream(int streamId)Indicates whether or not this endpoint may have created the given stream.intnumActiveStreams()Gets the number of active streams (i.e.Http2Connection.Endpoint<? extends Http2FlowController>opposite()Gets theHttp2Connection.Endpointopposite this one.Http2StreamreservePushStream(int streamId, Http2Stream parent)Creates a push stream in the reserved state for this endpoint and notifies all listeners.
-
-
-
Method Detail
-
incrementAndGetNextStreamId
int incrementAndGetNextStreamId()
Increment and get the next generated stream id this endpoint. If negative, the stream IDs are exhausted for this endpoint an no further streams may be created.
-
isValidStreamId
boolean isValidStreamId(int streamId)
Indicates whether the given streamId is from the set of IDs used by this endpoint to create new streams.
-
mayHaveCreatedStream
boolean mayHaveCreatedStream(int streamId)
Indicates whether or not this endpoint may have created the given stream. This istrueifisValidStreamId(int)andstreamId<=lastStreamCreated().
-
created
boolean created(Http2Stream stream)
Indicates whether or not this endpoint created the given stream.
-
canOpenStream
boolean canOpenStream()
Indicates whether or a stream created by this endpoint can be opened without violatingmaxActiveStreams().
-
createStream
Http2Stream createStream(int streamId, boolean halfClosed) throws Http2Exception
Creates a stream initiated by this endpoint. This could fail for the following reasons:- The requested stream ID is not the next sequential ID for this endpoint.
- The stream already exists.
canOpenStream()isfalse.- The connection is marked as going away.
The initial state of the stream will be immediately set before notifying
Http2Connection.Listeners. The state transition is sensitive tohalfClosedand is defined byHttp2Stream.open(boolean).- Parameters:
streamId- The ID of the streamhalfClosed- seeHttp2Stream.open(boolean).- Throws:
Http2Exception- See Also:
Http2Stream.open(boolean)
-
reservePushStream
Http2Stream reservePushStream(int streamId, Http2Stream parent) throws Http2Exception
Creates a push stream in the reserved state for this endpoint and notifies all listeners. This could fail for the following reasons:- Server push is not allowed to the opposite endpoint.
- The requested stream ID is not the next sequential stream ID for this endpoint.
- The number of concurrent streams is above the allowed threshold for this endpoint.
- The connection is marked as going away.
- The parent stream ID does not exist or is not
OPENfrom the side sending the push promise. - Could not set a valid priority for the new stream.
- Parameters:
streamId- the ID of the push streamparent- the parent stream used to initiate the push stream.- Throws:
Http2Exception
-
isServer
boolean isServer()
Indicates whether or not this endpoint is the server-side of the connection.
-
allowPushTo
void allowPushTo(boolean allow)
This is the SETTINGS_ENABLE_PUSH value sent from the opposite endpoint. This method should only be called by Netty (not users) as a result of a receiving aSETTINGSframe.
-
allowPushTo
boolean allowPushTo()
This is the SETTINGS_ENABLE_PUSH value sent from the opposite endpoint. The initial value must betruefor the client endpoint and always false for a server endpoint.
-
numActiveStreams
int numActiveStreams()
Gets the number of active streams (i.e.OPENorHALF CLOSED) that were created by this endpoint.
-
maxActiveStreams
int maxActiveStreams()
Gets the maximum number of streams (created by this endpoint) that are allowed to be active at the same time. This is the SETTINGS_MAX_CONCURRENT_STREAMS value sent from the opposite endpoint to restrict stream creation by this endpoint.The default value returned by this method must be "unlimited".
-
maxActiveStreams
void maxActiveStreams(int maxActiveStreams)
Sets the limit forSETTINGS_MAX_CONCURRENT_STREAMS.- Parameters:
maxActiveStreams- The maximum number of streams (created by this endpoint) that are allowed to be active at once. This is the SETTINGS_MAX_CONCURRENT_STREAMS value sent from the opposite endpoint to restrict stream creation by this endpoint.
-
lastStreamCreated
int lastStreamCreated()
Gets the ID of the stream last successfully created by this endpoint.
-
lastStreamKnownByPeer
int lastStreamKnownByPeer()
If a GOAWAY was received for this endpoint, this will be the last stream ID from the GOAWAY frame. Otherwise, this will be-1.
-
flowController
F flowController()
Gets the flow controller for this endpoint.
-
flowController
void flowController(F flowController)
Sets the flow controller for this endpoint.
-
opposite
Http2Connection.Endpoint<? extends Http2FlowController> opposite()
Gets theHttp2Connection.Endpointopposite this one.
-
-