Session, ISession, Parser.Listener, Container, Destroyable, Dumpable, LifeCycle@ManagedObject public abstract class HTTP2Session extends ContainerLifeCycle implements ISession, Parser.Listener
AbstractLifeCycle.AbstractLifeCycleListenerContainer.InheritedListener, Container.ListenerLifeCycle.ListenerParser.Listener.AdapterSession.ListenerFAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING| Constructor | Description |
|---|---|
HTTP2Session(Scheduler scheduler,
EndPoint endPoint,
Generator generator,
Session.Listener listener,
FlowControlStrategy flowControl,
int initialStreamId) |
| Modifier and Type | Method | Description |
|---|---|---|
protected void |
abort(java.lang.Throwable failure) |
|
boolean |
close(int error,
java.lang.String reason,
Callback callback) |
Invoked internally and by applications to send a GO_AWAY frame to the
other peer.
|
protected IStream |
createLocalStream(int streamId,
Promise<Stream> promise) |
|
protected IStream |
createRemoteStream(int streamId) |
|
void |
data(IStream stream,
Callback callback,
DataFrame frame) |
Enqueues the given DATA frame to be written to the connection.
|
void |
disconnect() |
|
protected void |
doStop() |
|
void |
dump(java.lang.Appendable out,
java.lang.String indent) |
|
void |
frames(IStream stream,
Callback callback,
Frame frame,
Frame... frames) |
Enqueues the given frames to be written to the connection.
|
long |
getBytesWritten() |
|
EndPoint |
getEndPoint() |
|
FlowControlStrategy |
getFlowControlStrategy() |
|
Generator |
getGenerator() |
|
int |
getInitialSessionRecvWindow() |
|
int |
getMaxLocalStreams() |
|
int |
getMaxRemoteStreams() |
|
int |
getRecvWindow() |
|
int |
getSendWindow() |
|
IStream |
getStream(int streamId) |
Retrieves the stream with the given
streamId. |
int |
getStreamCount() |
|
long |
getStreamIdleTimeout() |
|
java.util.Collection<Stream> |
getStreams() |
|
int |
getWriteThreshold() |
|
boolean |
isClosed() |
|
boolean |
isDisconnected() |
|
boolean |
isPushEnabled() |
|
protected IStream |
newStream(int streamId,
boolean local) |
|
void |
newStream(HeadersFrame frame,
Promise<Stream> promise,
Stream.Listener listener) |
Sends the given HEADERS
frame to create a new Stream. |
protected void |
notifyClose(Session session,
GoAwayFrame frame,
Callback callback) |
|
protected void |
notifyFailure(Session session,
java.lang.Throwable failure,
Callback callback) |
|
protected void |
notifyHeaders(IStream stream,
HeadersFrame frame) |
|
protected boolean |
notifyIdleTimeout(Session session) |
|
protected Stream.Listener |
notifyNewStream(Stream stream,
HeadersFrame frame) |
|
protected void |
notifyPing(Session session,
PingFrame frame) |
|
protected void |
notifyReset(Session session,
ResetFrame frame) |
|
protected void |
notifySettings(Session session,
SettingsFrame frame) |
|
void |
onConnectionFailure(int error,
java.lang.String reason) |
|
void |
onData(DataFrame frame) |
|
void |
onFlushed(long bytes) |
Callback method invoked when bytes are flushed to the network.
|
void |
onFrame(Frame frame) |
Callback method invoked during an HTTP/1.1 to HTTP/2 upgrade requests
to process the given synthetic frame.
|
void |
onGoAway(GoAwayFrame frame) |
This method is called when receiving a GO_AWAY from the other peer.
|
abstract void |
onHeaders(HeadersFrame frame) |
|
boolean |
onIdleTimeout() |
This method is invoked when the idle timeout triggers.
|
void |
onPing(PingFrame frame) |
|
void |
onPriority(PriorityFrame frame) |
|
void |
onReset(ResetFrame frame) |
|
void |
onSettings(SettingsFrame frame) |
|
void |
onSettings(SettingsFrame frame,
boolean reply) |
|
void |
onShutdown() |
A typical close by a remote peer involves a GO_AWAY frame followed by TCP FIN.
|
protected void |
onStreamClosed(IStream stream) |
|
protected void |
onStreamOpened(IStream stream) |
|
void |
onWindowUpdate(WindowUpdateFrame frame) |
|
void |
onWindowUpdate(IStream stream,
WindowUpdateFrame frame) |
Callback method invoked when a WINDOW_UPDATE frame has been received.
|
void |
ping(PingFrame frame,
Callback callback) |
Sends the given PING
frame. |
int |
priority(PriorityFrame frame,
Callback callback) |
Sends the given PRIORITY
frame. |
void |
push(IStream stream,
Promise<Stream> promise,
PushPromiseFrame frame,
Stream.Listener listener) |
Enqueues the given PUSH_PROMISE frame to be written to the connection.
|
void |
removeStream(IStream stream) |
Removes the given
stream. |
protected void |
reset(ResetFrame frame,
Callback callback) |
|
void |
setInitialSessionRecvWindow(int initialSessionRecvWindow) |
|
void |
setMaxLocalStreams(int maxLocalStreams) |
|
void |
setMaxRemoteStreams(int maxRemoteStreams) |
|
void |
setStreamIdleTimeout(long streamIdleTimeout) |
|
void |
settings(SettingsFrame frame,
Callback callback) |
Sends the given SETTINGS
frame to configure the session. |
void |
setWriteThreshold(int writeThreshold) |
|
java.lang.String |
toString() |
|
int |
updateRecvWindow(int delta) |
Updates the session receive window by the given
delta. |
int |
updateSendWindow(int delta) |
Updates the session send window by the given
delta. |
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopaddBean, addBean, addBean, addEventListener, addManaged, contains, destroy, doStart, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitonPushPromisepublic HTTP2Session(Scheduler scheduler, EndPoint endPoint, Generator generator, Session.Listener listener, FlowControlStrategy flowControl, int initialStreamId)
protected void doStop()
throws java.lang.Exception
doStop in class ContainerLifeCyclejava.lang.Exception@ManagedAttribute(value="The flow control strategy", readonly=true) public FlowControlStrategy getFlowControlStrategy()
public int getMaxLocalStreams()
public void setMaxLocalStreams(int maxLocalStreams)
public int getMaxRemoteStreams()
public void setMaxRemoteStreams(int maxRemoteStreams)
@ManagedAttribute("The stream\'s idle timeout") public long getStreamIdleTimeout()
public void setStreamIdleTimeout(long streamIdleTimeout)
@ManagedAttribute("The initial size of session\'s flow control receive window") public int getInitialSessionRecvWindow()
public void setInitialSessionRecvWindow(int initialSessionRecvWindow)
public int getWriteThreshold()
public void setWriteThreshold(int writeThreshold)
public EndPoint getEndPoint()
public Generator getGenerator()
public long getBytesWritten()
getBytesWritten in interface ISessionpublic void onData(DataFrame frame)
onData in interface Parser.Listenerpublic abstract void onHeaders(HeadersFrame frame)
onHeaders in interface Parser.Listenerpublic void onPriority(PriorityFrame frame)
onPriority in interface Parser.Listenerpublic void onReset(ResetFrame frame)
onReset in interface Parser.Listenerpublic void onSettings(SettingsFrame frame)
onSettings in interface Parser.Listenerpublic void onSettings(SettingsFrame frame, boolean reply)
public void onPing(PingFrame frame)
onPing in interface Parser.Listenerpublic void onGoAway(GoAwayFrame frame)
HTTP2Session.ControlEntry#succeeded()onGoAway in interface Parser.Listenerframe - the GO_AWAY frame that has been received.close(int, String, Callback),
onShutdown(),
onIdleTimeout()public void onWindowUpdate(WindowUpdateFrame frame)
onWindowUpdate in interface Parser.Listenerpublic void onConnectionFailure(int error,
java.lang.String reason)
onConnectionFailure in interface Parser.Listenerpublic void newStream(HeadersFrame frame, Promise<Stream> promise, Stream.Listener listener)
SessionSends the given HEADERS frame to create a new Stream.
public int priority(PriorityFrame frame, Callback callback)
SessionSends the given PRIORITY frame.
If the frame references a streamId that does not exist
(for example 0), then a new streamId will be allocated, to
support unused anchor streams that act as parent for other streams.
public void push(IStream stream, Promise<Stream> promise, PushPromiseFrame frame, Stream.Listener listener)
ISessionEnqueues the given PUSH_PROMISE frame to be written to the connection.
Differently from ISession.frames(IStream, Callback, Frame, Frame...), this method
generates atomically the stream id for the pushed stream.
public void settings(SettingsFrame frame, Callback callback)
SessionSends the given SETTINGS frame to configure the session.
public void ping(PingFrame frame, Callback callback)
SessionSends the given PING frame.
PING frames may be used to test the connection integrity and to measure round-trip time.
protected void reset(ResetFrame frame, Callback callback)
public boolean close(int error,
java.lang.String reason,
Callback callback)
onShutdown().
Otherwise, the idle timeout mechanism will close the connection, see
onIdleTimeout().close in interface Sessionerror - the error codereason - the reasoncallback - the callback to invoke when the operation is completeonGoAway(GoAwayFrame),
onShutdown(),
onIdleTimeout()public boolean isClosed()
public void frames(IStream stream, Callback callback, Frame frame, Frame... frames)
ISessionEnqueues the given frames to be written to the connection.
public void data(IStream stream, Callback callback, DataFrame frame)
ISessionEnqueues the given DATA frame to be written to the connection.
protected IStream createRemoteStream(int streamId)
protected IStream newStream(int streamId, boolean local)
public void removeStream(IStream stream)
ISessionRemoves the given stream.
removeStream in interface ISessionstream - the stream to removepublic java.util.Collection<Stream> getStreams()
getStreams in interface Session@ManagedAttribute("The number of active streams") public int getStreamCount()
public IStream getStream(int streamId)
SessionRetrieves the stream with the given streamId.
@ManagedAttribute(value="The flow control send window", readonly=true) public int getSendWindow()
@ManagedAttribute(value="The flow control receive window", readonly=true) public int getRecvWindow()
public int updateSendWindow(int delta)
ISessionUpdates the session send window by the given delta.
updateSendWindow in interface ISessiondelta - the delta value (positive or negative) to add to the session send windowpublic int updateRecvWindow(int delta)
ISessionUpdates the session receive window by the given delta.
updateRecvWindow in interface ISessiondelta - the delta value (positive or negative) to add to the session receive windowpublic void onWindowUpdate(IStream stream, WindowUpdateFrame frame)
ISessionCallback method invoked when a WINDOW_UPDATE frame has been received.
onWindowUpdate in interface ISessionstream - the stream the window update belongs to, or null if the window update belongs to the sessionframe - the WINDOW_UPDATE frame received@ManagedAttribute(value="Whether HTTP/2 push is enabled", readonly=true) public boolean isPushEnabled()
isPushEnabled in interface ISessionpublic void onShutdown()
close(int, String, Callback).onGoAway(GoAwayFrame).onShutdown in interface ISessiononGoAway(GoAwayFrame),
close(int, String, Callback),
onIdleTimeout()public boolean onIdleTimeout()
close(int, String, Callback).onGoAway(GoAwayFrame).onIdleTimeout in interface ISessiononGoAway(GoAwayFrame),
close(int, String, Callback),
onShutdown()public void onFrame(Frame frame)
ISessionCallback method invoked during an HTTP/1.1 to HTTP/2 upgrade requests to process the given synthetic frame.
protected void onStreamOpened(IStream stream)
protected void onStreamClosed(IStream stream)
public void onFlushed(long bytes)
throws java.io.IOException
ISessionCallback method invoked when bytes are flushed to the network.
public void disconnect()
protected void abort(java.lang.Throwable failure)
public boolean isDisconnected()
protected Stream.Listener notifyNewStream(Stream stream, HeadersFrame frame)
protected void notifySettings(Session session, SettingsFrame frame)
protected void notifyReset(Session session, ResetFrame frame)
protected void notifyClose(Session session, GoAwayFrame frame, Callback callback)
protected boolean notifyIdleTimeout(Session session)
protected void notifyFailure(Session session, java.lang.Throwable failure, Callback callback)
protected void notifyHeaders(IStream stream, HeadersFrame frame)
public void dump(java.lang.Appendable out,
java.lang.String indent)
throws java.io.IOException
dump in interface Dumpabledump in class ContainerLifeCyclejava.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 1995–2018 Webtide. All rights reserved.