All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.firefly.codec.http2.stream.SessionSPI Maven / Gradle / Ivy

There is a newer version: 4.0.3.2
Show newest version
package com.firefly.codec.http2.stream;

import com.firefly.codec.http2.frame.DataFrame;
import com.firefly.codec.http2.frame.Frame;
import com.firefly.codec.http2.frame.PushPromiseFrame;
import com.firefly.codec.http2.frame.WindowUpdateFrame;
import com.firefly.utils.concurrent.Callback;
import com.firefly.utils.concurrent.Promise;

/**
 * 

* The SPI interface for implementing a HTTP/2 session. *

*

* This class extends {@link Session} by adding the methods required to * implement the HTTP/2 session functionalities. *

*/ public interface SessionSPI extends Session { @Override public StreamSPI getStream(int streamId); /** *

* Removes the given {@code stream}. *

* * @param stream * the stream to remove */ public void removeStream(StreamSPI stream); /** *

* Enqueues the given frames to be written to the connection. *

* * @param stream * the stream the frames belong to * @param callback * the callback that gets notified when the frames have been sent * @param frame * the first frame to enqueue * @param frames * additional frames to enqueue */ public void frames(StreamSPI stream, Callback callback, Frame frame, Frame... frames); /** *

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

*

* Differently from {@link #frames(StreamSPI, Callback, Frame, Frame...)}, * this method generates atomically the stream id for the pushed stream. *

* * @param stream * the stream associated to the pushed stream * @param promise * the promise that gets notified of the pushed stream creation * @param frame * the PUSH_PROMISE frame to enqueue * @param listener * the listener that gets notified of pushed stream events */ public void push(StreamSPI stream, Promise promise, PushPromiseFrame frame, Stream.Listener listener); /** *

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

* * @param stream * the stream the data frame belongs to * @param callback * the callback that gets notified when the frame has been sent * @param frame * the DATA frame to send */ public void data(StreamSPI stream, Callback callback, DataFrame frame); /** *

* Updates the session send window by the given {@code delta}. *

* * @param delta * the delta value (positive or negative) to add to the session * send window * @return the previous value of the session send window */ public int updateSendWindow(int delta); /** *

* Updates the session receive window by the given {@code delta}. *

* * @param delta * the delta value (positive or negative) to add to the session * receive window * @return the previous value of the session receive window */ public int updateRecvWindow(int delta); /** *

* Callback method invoked when a WINDOW_UPDATE frame has been received. *

* * @param stream * the stream the window update belongs to, or null if the window * update belongs to the session * @param frame * the WINDOW_UPDATE frame received */ public void onWindowUpdate(StreamSPI stream, WindowUpdateFrame frame); /** * @return whether the push functionality is enabled */ public boolean isPushEnabled(); /** *

* Callback invoked when the connection reads -1. *

* * @see #onIdleTimeout() * @see #close(int, String, Callback) */ public void onShutdown(); /** *

* Callback invoked when the idle timeout expires. *

* * @see #onShutdown() * @see #close(int, String, Callback) * @return whether the session should be closed */ public boolean onIdleTimeout(); /** *

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

* * @param frame * the synthetic frame to process */ public void onFrame(Frame frame); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy