public class StandardSession extends Object implements ISession, Parser.Listener, Dumpable
| Modifier and Type | Class and Description |
|---|---|
protected class |
StandardSession.CloseFrameBytes |
protected class |
StandardSession.ControlFrameBytes |
protected class |
StandardSession.DataFrameBytes |
static interface |
StandardSession.FrameBytes |
Session.Listener, Session.StreamListenerParser.Listener.Adapter| Constructor and Description |
|---|
StandardSession(short version,
ByteBufferPool bufferPool,
Scheduler scheduler,
Controller controller,
EndPoint endPoint,
IdleListener idleListener,
int initialStreamId,
SessionFrameListener listener,
Generator generator,
FlowControlStrategy flowControlStrategy) |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(Session.Listener listener)
Registers the given
listener to be notified of session events. |
protected void |
close() |
void |
control(IStream stream,
ControlFrame frame,
long timeout,
TimeUnit unit,
Callback callback) |
void |
data(IStream stream,
DataInfo dataInfo,
long timeout,
TimeUnit unit,
Callback callback) |
String |
dump() |
void |
dump(Appendable out,
String indent) |
Object |
getAttribute(String key) |
InetSocketAddress |
getLocalAddress() |
InetSocketAddress |
getRemoteAddress() |
IStream |
getStream(int streamId) |
Set<Stream> |
getStreams() |
short |
getVersion() |
int |
getWindowSize() |
void |
goAway(GoAwayInfo goAwayInfo)
Closes gracefully this session, sending a GO_AWAY frame and then closing the TCP connection.
|
void |
goAway(GoAwayInfo goAwayInfo,
Callback callback)
Closes gracefully this session, sending a GO_AWAY frame and then closing the TCP connection.
|
void |
onControlFrame(ControlFrame frame) |
void |
onDataFrame(DataFrame frame,
ByteBuffer data) |
void |
onSessionException(SessionException x) |
void |
onStreamException(StreamException x) |
PingResultInfo |
ping(PingInfo pingInfo)
Sends synchronously a PING, normally to measure round-trip time.
|
void |
ping(PingInfo pingInfo,
Promise<PingResultInfo> promise)
Sends asynchronously a PING, normally to measure round-trip time.
|
Object |
removeAttribute(String key) |
void |
removeListener(Session.Listener listener)
Deregisters the give
listener from being notified of session events. |
void |
rst(RstInfo rstInfo)
Sends synchronously a RST_STREAM to abort a stream.
|
void |
rst(RstInfo rstInfo,
Callback callback)
Sends asynchronously a RST_STREAM to abort a stream.
|
void |
setAttribute(String key,
Object value) |
void |
settings(SettingsInfo settingsInfo)
Sends synchronously a SETTINGS to configure the SPDY connection.
|
void |
settings(SettingsInfo settingsInfo,
Callback callback)
Sends asynchronously a SETTINGS to configure the SPDY connection.
|
void |
setWindowSize(int initialWindowSize) |
void |
shutdown()
Gracefully shuts down this session.
|
Stream |
syn(SynInfo synInfo,
StreamFrameListener listener)
Sends a SYN_FRAME to create a new
SPDY stream. |
void |
syn(SynInfo synInfo,
StreamFrameListener listener,
Promise<Stream> promise)
Sends asynchronously a SYN_FRAME to create a new
SPDY stream. |
String |
toString() |
public StandardSession(short version,
ByteBufferPool bufferPool,
Scheduler scheduler,
Controller controller,
EndPoint endPoint,
IdleListener idleListener,
int initialStreamId,
SessionFrameListener listener,
Generator generator,
FlowControlStrategy flowControlStrategy)
public short getVersion()
getVersion in interface Sessionpublic void addListener(Session.Listener listener)
SessionRegisters the given listener to be notified of session events.
addListener in interface Sessionlistener - the listener to registerSession.removeListener(Listener)public void removeListener(Session.Listener listener)
SessionDeregisters the give listener from being notified of session events.
removeListener in interface Sessionlistener - the listener to deregisterSession.addListener(Listener)public Stream syn(SynInfo synInfo, StreamFrameListener listener) throws ExecutionException, InterruptedException, TimeoutException
SessionSends a SYN_FRAME to create a new SPDY stream.
Callers may use the returned Stream for example, to send data frames.
syn in interface SessionsynInfo - the metadata to send on stream creationlistener - the listener to invoke when events happen on the stream just createdExecutionExceptionInterruptedExceptionTimeoutExceptionSession.syn(SynInfo, StreamFrameListener, Promise)public void syn(SynInfo synInfo, StreamFrameListener listener, Promise<Stream> promise)
SessionSends asynchronously a SYN_FRAME to create a new SPDY stream.
Callers may pass a non-null completion callback to be notified of when the stream has been created and use the stream, for example, to send data frames.
syn in interface SessionsynInfo - the metadata to send on stream creationlistener - the listener to invoke when events happen on the stream just createdpromise - the completion callback that gets notified of stream creationSession.syn(SynInfo, StreamFrameListener)public void rst(RstInfo rstInfo) throws InterruptedException, ExecutionException, TimeoutException
SessionSends synchronously a RST_STREAM to abort a stream.
rst in interface SessionrstInfo - the metadata to reset the streamInterruptedExceptionExecutionExceptionTimeoutExceptionSession.rst(RstInfo, Callback)public void rst(RstInfo rstInfo, Callback callback)
SessionSends asynchronously a RST_STREAM to abort a stream.
Callers may pass a non-null completion callback to be notified of when the reset has been actually sent.
rst in interface SessionrstInfo - the metadata to reset the streamcallback - the completion callback that gets notified of reset's sendSession.rst(RstInfo)public void settings(SettingsInfo settingsInfo) throws ExecutionException, InterruptedException, TimeoutException
SessionSends synchronously a SETTINGS to configure the SPDY connection.
settings in interface SessionsettingsInfo - the metadata to sendExecutionExceptionInterruptedExceptionTimeoutExceptionSession.settings(SettingsInfo, Callback)public void settings(SettingsInfo settingsInfo, Callback callback)
SessionSends asynchronously a SETTINGS to configure the SPDY connection.
Callers may pass a non-null completion callback to be notified of when the settings has been actually sent.
settings in interface SessionsettingsInfo - the metadata to sendcallback - the completion callback that gets notified of settings' sendSession.settings(SettingsInfo)public PingResultInfo ping(PingInfo pingInfo) throws ExecutionException, InterruptedException, TimeoutException
SessionSends synchronously a PING, normally to measure round-trip time.
ping in interface SessionExecutionExceptionInterruptedExceptionTimeoutExceptionSession.ping(PingInfo, Promise)public void ping(PingInfo pingInfo, Promise<PingResultInfo> promise)
SessionSends asynchronously a PING, normally to measure round-trip time.
Callers may pass a non-null completion callback to be notified of when the ping has been actually sent.
ping in interface Sessionpromise - the completion callback that gets notified of ping's sendSession.ping(PingInfo)public void goAway(GoAwayInfo goAwayInfo) throws ExecutionException, InterruptedException, TimeoutException
SessionCloses gracefully this session, sending a GO_AWAY frame and then closing the TCP connection.
goAway in interface SessionExecutionExceptionInterruptedExceptionTimeoutExceptionSession.goAway(GoAwayInfo, Callback)public void goAway(GoAwayInfo goAwayInfo, Callback callback)
SessionCloses gracefully this session, sending a GO_AWAY frame and then closing the TCP connection.
Callers may pass a non-null completion callback to be notified of when the go away has been actually sent.
goAway in interface Sessioncallback - the completion callback that gets notified of go away's sendSession.goAway(GoAwayInfo)public Set<Stream> getStreams()
getStreams in interface SessionSession.getStream(int)public IStream getStream(int streamId)
getStream in interface SessionstreamId - the id of the stream to retrieveSession.getStreams()public Object getAttribute(String key)
getAttribute in interface Sessionkey - the attribute keySession.setAttribute(String, Object)public void setAttribute(String key, Object value)
setAttribute in interface Sessionkey - the attribute keyvalue - an arbitrary object to associate with the given key to this sessionSession.getAttribute(String),
Session.removeAttribute(String)public Object removeAttribute(String key)
removeAttribute in interface Sessionkey - the attribute keySession.setAttribute(String, Object)public InetSocketAddress getLocalAddress()
getLocalAddress in interface Sessionpublic InetSocketAddress getRemoteAddress()
getRemoteAddress in interface Sessionpublic void onControlFrame(ControlFrame frame)
onControlFrame in interface Parser.Listenerpublic void onDataFrame(DataFrame frame, ByteBuffer data)
onDataFrame in interface Parser.Listenerpublic void onStreamException(StreamException x)
onStreamException in interface Parser.Listenerpublic void onSessionException(SessionException x)
onSessionException in interface Parser.Listenerprotected void close()
public void control(IStream stream, ControlFrame frame, long timeout, TimeUnit unit, Callback callback)
public void data(IStream stream, DataInfo dataInfo, long timeout, TimeUnit unit, Callback callback)
public void shutdown()
ISessionGracefully shuts down this session.
A special item is queued that will close the connection when it will be dequeued.
public int getWindowSize()
public void setWindowSize(int initialWindowSize)
public void dump(Appendable out, String indent) throws IOException
dump in interface DumpableIOExceptionCopyright © 1995-2015 Webtide. All Rights Reserved.