Interface ISession

    • Method Detail

      • getStream

        IStream getStream​(int streamId)
        Description copied from interface: Session

        Retrieves the stream with the given streamId.

        Specified by:
        getStream in interface Session
        Parameters:
        streamId - the stream id of the stream looked for
        Returns:
        the stream with the given id, or null if no such stream exist
      • removeStream

        void removeStream​(IStream stream)

        Removes the given stream.

        Parameters:
        stream - the stream to remove
      • frames

        void frames​(IStream stream,
                    Callback callback,
                    Frame frame,
                    Frame... frames)

        Enqueues the given frames to be written to the connection.

        Parameters:
        stream - the stream the frames belong to
        callback - the callback that gets notified when the frames have been sent
        frame - the first frame to enqueue
        frames - additional frames to enqueue
      • push

        void push​(IStream stream,
                  Promise<Stream> promise,
                  PushPromiseFrame frame,
                  Stream.Listener listener)

        Enqueues the given PUSH_PROMISE frame to be written to the connection.

        Differently from frames(IStream, Callback, Frame, Frame...), this method generates atomically the stream id for the pushed stream.

        Parameters:
        stream - the stream associated to the pushed stream
        promise - the promise that gets notified of the pushed stream creation
        frame - the PUSH_PROMISE frame to enqueue
        listener - the listener that gets notified of pushed stream events
      • data

        void data​(IStream stream,
                  Callback callback,
                  DataFrame frame)

        Enqueues the given DATA frame to be written to the connection.

        Parameters:
        stream - the stream the data frame belongs to
        callback - the callback that gets notified when the frame has been sent
        frame - the DATA frame to send
      • updateSendWindow

        int updateSendWindow​(int delta)

        Updates the session send window by the given delta.

        Parameters:
        delta - the delta value (positive or negative) to add to the session send window
        Returns:
        the previous value of the session send window
      • updateRecvWindow

        int updateRecvWindow​(int delta)

        Updates the session receive window by the given delta.

        Parameters:
        delta - the delta value (positive or negative) to add to the session receive window
        Returns:
        the previous value of the session receive window
      • onWindowUpdate

        void onWindowUpdate​(IStream stream,
                            WindowUpdateFrame frame)

        Callback method invoked when a WINDOW_UPDATE frame has been received.

        Parameters:
        stream - the stream the window update belongs to, or null if the window update belongs to the session
        frame - the WINDOW_UPDATE frame received
      • isPushEnabled

        boolean isPushEnabled()
        Returns:
        whether the push functionality is enabled
      • onFrame

        void onFrame​(Frame frame)

        Callback method invoked during an HTTP/1.1 to HTTP/2 upgrade requests to process the given synthetic frame.

        Parameters:
        frame - the synthetic frame to process
      • onFlushed

        void onFlushed​(long bytes)
                throws java.io.IOException

        Callback method invoked when bytes are flushed to the network.

        Parameters:
        bytes - the number of bytes flushed to the network
        Throws:
        java.io.IOException - if the flush should fail
      • getBytesWritten

        long getBytesWritten()
        Returns:
        the number of bytes written by this session
      • onData

        void onData​(DataFrame frame,
                    Callback callback)

        Callback method invoked when a DATA frame is received.

        Parameters:
        frame - the DATA frame received
        callback - the callback to notify when the frame has been processed