Interface Http2Connection.Endpoint<F extends Http2FlowController>

All Known Implementing Classes:
DefaultHttp2Connection.DefaultEndpoint
Enclosing interface:
Http2Connection

public static interface Http2Connection.Endpoint<F extends Http2FlowController>
A view of the connection from one endpoint (local or remote).
  • Method Details

    • 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 is true if isValidStreamId(int) and streamId invalid input: '<'= 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 violating maxActiveStreams().
    • 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() is false.
      • 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 to halfClosed and is defined by Http2Stream.open(boolean).

      Parameters:
      streamId - The ID of the stream
      halfClosed - see Http2Stream.open(boolean).
      Throws:
      Http2Exception
      See Also:
    • 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 OPEN from the side sending the push promise.
      • Could not set a valid priority for the new stream.
      Parameters:
      streamId - the ID of the push stream
      parent - 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 a SETTINGS frame.
    • allowPushTo

      boolean allowPushTo()
      This is the SETTINGS_ENABLE_PUSH value sent from the opposite endpoint. The initial value must be true for the client endpoint and always false for a server endpoint.
    • numActiveStreams

      int numActiveStreams()
      Gets the number of active streams (i.e. OPEN or HALF 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 for SETTINGS_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

      Gets the Http2Connection.Endpoint opposite this one.