Class HTTP2Stream

    • Constructor Detail

      • HTTP2Stream

        public HTTP2Stream​(Scheduler scheduler,
                           ISession session,
                           int streamId,
                           boolean local)
    • Method Detail

      • getId

        public int getId()
        Specified by:
        getId in interface Stream
        Returns:
        the stream unique id
      • setAttachment

        public void setAttachment​(java.lang.Object attachment)
        Description copied from interface: Attachable
        Attaches the given object to this stream for later retrieval.
        Specified by:
        setAttachment in interface Attachable
        Parameters:
        attachment - the object to attach to this instance
      • isLocal

        public boolean isLocal()
        Specified by:
        isLocal in interface IStream
        Returns:
        whether this stream is local or remote
      • send

        public void send​(IStream.FrameList frameList,
                         Callback callback)
        Description copied from interface: IStream

        Sends the given list of frames.

        Typically used to send HTTP headers along with content and possibly trailers.

        Specified by:
        send in interface IStream
        Parameters:
        frameList - the list of frames to send
        callback - the callback that gets notified when the frames have been sent
      • headers

        public void headers​(HeadersFrame frame,
                            Callback callback)
        Description copied from interface: Stream

        Sends the given HEADERS frame.

        Typically used to send an HTTP response or to send the HTTP response trailers.

        Specified by:
        headers in interface Stream
        Parameters:
        frame - the HEADERS frame to send
        callback - the callback that gets notified when the frame has been sent
      • push

        public void push​(PushPromiseFrame frame,
                         Promise<Stream> promise,
                         Stream.Listener listener)
        Description copied from interface: Stream

        Sends the given PUSH_PROMISE frame.

        Specified by:
        push in interface Stream
        Parameters:
        frame - the PUSH_PROMISE frame to send
        promise - the promise that gets notified of the pushed stream creation
        listener - the listener that gets notified of stream events
      • data

        public void data​(DataFrame frame,
                         Callback callback)
        Description copied from interface: Stream

        Sends the given DATA frame.

        Specified by:
        data in interface Stream
        Parameters:
        frame - the DATA frame to send
        callback - the callback that gets notified when the frame has been sent
      • reset

        public void reset​(ResetFrame frame,
                          Callback callback)
        Description copied from interface: Stream

        Sends the given RST_STREAM frame.

        Specified by:
        reset in interface Stream
        Parameters:
        frame - the RST_FRAME to send
        callback - the callback that gets notified when the frame has been sent
      • getAttribute

        public java.lang.Object getAttribute​(java.lang.String key)
        Specified by:
        getAttribute in interface Stream
        Parameters:
        key - the attribute key
        Returns:
        an arbitrary object associated with the given key to this stream or null if no object can be found for the given key.
        See Also:
        Stream.setAttribute(String, Object)
      • removeAttribute

        public java.lang.Object removeAttribute​(java.lang.String key)
        Specified by:
        removeAttribute in interface Stream
        Parameters:
        key - the attribute key
        Returns:
        the arbitrary object associated with the given key to this stream
        See Also:
        Stream.setAttribute(String, Object)
      • isReset

        public boolean isReset()
        Specified by:
        isReset in interface Stream
        Returns:
        whether this stream has been reset
      • isClosed

        public boolean isClosed()
        Specified by:
        isClosed in interface Stream
        Returns:
        whether this stream is closed, both locally and remotely.
      • isLocallyClosed

        public boolean isLocallyClosed()
      • isCommitted

        public boolean isCommitted()
        Specified by:
        isCommitted in interface IStream
        Returns:
        whether bytes for this stream have been sent to the remote peer.
        See Also:
        IStream.commit()
      • isOpen

        public boolean isOpen()
        Description copied from class: IdleTimeout
        This abstract method should be called to check if idle timeouts should still be checked.
        Specified by:
        isOpen in class IdleTimeout
        Returns:
        True if the entity monitored should still be checked for idle timeouts
      • onIdleExpired

        protected void onIdleExpired​(java.util.concurrent.TimeoutException timeout)
        Description copied from class: IdleTimeout
        This abstract method is called when the idle timeout has expired.
        Specified by:
        onIdleExpired in class IdleTimeout
        Parameters:
        timeout - a TimeoutException
      • process

        public void process​(Frame frame,
                            Callback callback)
        Description copied from interface: IStream

        Processes the given frame, belonging to this stream.

        Specified by:
        process in interface IStream
        Parameters:
        frame - the frame to process
        callback - the callback to complete when frame has been processed
      • updateClose

        public boolean updateClose​(boolean update,
                                   CloseState.Event event)
        Description copied from interface: IStream

        Updates the close state of this stream.

        Specified by:
        updateClose in interface IStream
        Parameters:
        update - whether to update the close state
        event - the event that caused the close state update
        Returns:
        whether the stream has been fully closed by this invocation
      • getSendWindow

        public int getSendWindow()
      • getRecvWindow

        public int getRecvWindow()
      • updateSendWindow

        public int updateSendWindow​(int delta)
        Description copied from interface: IStream

        Updates the stream send window by the given delta.

        Specified by:
        updateSendWindow in interface IStream
        Parameters:
        delta - the delta value (positive or negative) to add to the stream send window
        Returns:
        the previous value of the stream send window
      • updateRecvWindow

        public int updateRecvWindow​(int delta)
        Description copied from interface: IStream

        Updates the stream receive window by the given delta.

        Specified by:
        updateRecvWindow in interface IStream
        Parameters:
        delta - the delta value (positive or negative) to add to the stream receive window
        Returns:
        the previous value of the stream receive window
      • close

        public void close()
        Description copied from interface: IStream

        Forcibly closes this stream.

        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface IStream
      • failed

        public void failed​(java.lang.Throwable x)
        Description copied from interface: Callback

        Callback invoked when the operation fails.

        Specified by:
        failed in interface Callback
        Parameters:
        x - the reason for the operation failure
      • dump

        public java.lang.String dump()
        Specified by:
        dump in interface Dumpable
      • dump

        public void dump​(java.lang.Appendable out,
                         java.lang.String indent)
                  throws java.io.IOException
        Description copied from interface: Dumpable
        Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.
        Specified by:
        dump in interface Dumpable
        Parameters:
        out - The appendable to dump to
        indent - The indent to apply after any new lines.
        Throws:
        java.io.IOException - if unable to write to Appendable
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object