public abstract class HTTP2Session extends Object implements ISession, Parser.Listener
Session.ListenerParser.Listener.Adapter| Constructor and Description |
|---|
HTTP2Session(Scheduler scheduler,
EndPoint endPoint,
Generator generator,
Session.Listener listener,
FlowControl flowControl,
int initialStreamId) |
| Modifier and Type | Method and Description |
|---|---|
void |
close(int error,
String reason,
Callback callback)
Invoked internally and by applications to send a GO_AWAY frame to the
other peer.
|
void |
control(IStream stream,
Callback callback,
Frame frame,
Frame... frames) |
protected IStream |
createLocalStream(int streamId,
Promise<Stream> promise) |
protected IStream |
createRemoteStream(int streamId) |
void |
data(IStream stream,
Callback callback,
DataFrame frame) |
void |
disconnect() |
EndPoint |
getEndPoint() |
FlowControl |
getFlowControl() |
Generator |
getGenerator() |
int |
getMaxLocalStreams() |
int |
getMaxRemoteStreams() |
protected int |
getRecvWindow() |
protected int |
getSendWindow() |
IStream |
getStream(int streamId) |
long |
getStreamIdleTimeout() |
Collection<Stream> |
getStreams() |
boolean |
isClosed() |
boolean |
isDisconnected() |
boolean |
isPushEnabled() |
void |
newStream(HeadersFrame frame,
Promise<Stream> promise,
Stream.Listener listener) |
protected IStream |
newStream(int streamId) |
protected void |
notifyClose(Session session,
GoAwayFrame frame) |
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,
String reason) |
boolean |
onData(DataFrame frame) |
boolean |
onGoAway(GoAwayFrame frame)
This method is called when receiving a GO_AWAY from the other peer.
|
abstract boolean |
onHeaders(HeadersFrame frame) |
void |
onIdleTimeout()
This method is invoked when the idle timeout triggers.
|
boolean |
onPing(PingFrame frame) |
boolean |
onPriority(PriorityFrame frame) |
boolean |
onReset(ResetFrame frame) |
boolean |
onSettings(SettingsFrame frame) |
void |
onShutdown()
A typical close by a remote peer involves a GO_AWAY frame followed by TCP FIN.
|
void |
onWindowUpdate(IStream stream,
WindowUpdateFrame frame) |
boolean |
onWindowUpdate(WindowUpdateFrame frame) |
void |
ping(PingFrame frame,
Callback callback) |
void |
push(IStream stream,
Promise<Stream> promise,
PushPromiseFrame frame) |
protected void |
removeStream(IStream stream,
boolean local) |
protected void |
reset(ResetFrame frame,
Callback callback) |
void |
setMaxLocalStreams(int maxLocalStreams) |
void |
setMaxRemoteStreams(int maxRemoteStreams) |
void |
setStreamIdleTimeout(long streamIdleTimeout) |
void |
settings(SettingsFrame frame,
Callback callback) |
String |
toString() |
int |
updateRecvWindow(int delta) |
int |
updateSendWindow(int delta) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitonPushPromisepublic HTTP2Session(Scheduler scheduler, EndPoint endPoint, Generator generator, Session.Listener listener, FlowControl flowControl, int initialStreamId)
public FlowControl getFlowControl()
public int getMaxLocalStreams()
public void setMaxLocalStreams(int maxLocalStreams)
public int getMaxRemoteStreams()
public void setMaxRemoteStreams(int maxRemoteStreams)
public long getStreamIdleTimeout()
public void setStreamIdleTimeout(long streamIdleTimeout)
public EndPoint getEndPoint()
public Generator getGenerator()
public boolean onData(DataFrame frame)
onData in interface Parser.Listenerpublic abstract boolean onHeaders(HeadersFrame frame)
onHeaders in interface Parser.Listenerpublic boolean onPriority(PriorityFrame frame)
onPriority in interface Parser.Listenerpublic boolean onReset(ResetFrame frame)
onReset in interface Parser.Listenerpublic boolean onSettings(SettingsFrame frame)
onSettings in interface Parser.Listenerpublic boolean onPing(PingFrame frame)
onPing in interface Parser.Listenerpublic boolean onGoAway(GoAwayFrame frame)
HTTP2Session.ControlEntry.succeeded()
* In all other cases, we do nothing since other methods are already
performing their actions.onGoAway in interface Parser.Listenerframe - the GO_AWAY frame that has been received.close(int, String, Callback),
onShutdown(),
onIdleTimeout()public boolean onWindowUpdate(WindowUpdateFrame frame)
onWindowUpdate in interface Parser.Listenerpublic void onConnectionFailure(int error,
String reason)
onConnectionFailure in interface Parser.Listenerpublic void newStream(HeadersFrame frame, Promise<Stream> promise, Stream.Listener listener)
public void push(IStream stream, Promise<Stream> promise, PushPromiseFrame frame)
public void settings(SettingsFrame frame, Callback callback)
protected void reset(ResetFrame frame, Callback callback)
public void close(int error,
String reason,
Callback callback)
onShutdown().
Otherwise, the idle timeout mechanism will close the connection, see
onIdleTimeout().
* In all other cases, we do nothing since other methods are already
performing their actions.close in interface Sessionerror - the error codereason - the reasoncallback - the callback to invoke when the operation is completeonGoAway(GoAwayFrame),
onShutdown(),
onIdleTimeout()protected IStream createRemoteStream(int streamId)
protected IStream newStream(int streamId)
protected void removeStream(IStream stream, boolean local)
public Collection<Stream> getStreams()
getStreams in interface Sessionpublic IStream getStream(int streamId)
protected int getSendWindow()
protected int getRecvWindow()
public int updateSendWindow(int delta)
updateSendWindow in interface ISessionpublic int updateRecvWindow(int delta)
updateRecvWindow in interface ISessionpublic void onWindowUpdate(IStream stream, WindowUpdateFrame frame)
onWindowUpdate in interface ISessionpublic boolean isPushEnabled()
isPushEnabled in interface ISessionpublic void onShutdown()
close(int, String, Callback).
* REMOTELY_CLOSED: we received the GO_AWAY, and the TCP FIN afterwards, so we
do nothing since the handling of the GO_AWAY will take care of closing the
connection. See onGoAway(GoAwayFrame).onShutdown in interface ISessiononGoAway(GoAwayFrame),
close(int, String, Callback),
onIdleTimeout()public void onIdleTimeout()
close(int, String, Callback).
* LOCALLY_CLOSED: we have sent a GO_AWAY and only shutdown the output, but the
other peer did not close the connection so we never received the TCP FIN, and
therefore we terminate.
* REMOTELY_CLOSED: the other peer sent us a GO_AWAY, we should have queued a
disconnect, but for some reason it was not processed (for example, queue was
stuck because of TCP congestion), therefore we terminate.
See onGoAway(GoAwayFrame).onIdleTimeout in interface ISessiononGoAway(GoAwayFrame),
close(int, String, Callback),
onShutdown()public void disconnect()
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)
Copyright © 1995-2014 Webtide. All Rights Reserved.