public class StandardSession extends Object implements ISession, Parser.Listener, Handler<StandardSession.FrameBytes>
| Modifier and Type | Class and Description |
|---|---|
static interface |
StandardSession.FrameBytes |
Session.Listener, Session.StreamListenerParser.Listener.AdapterHandler.Adapter<C>| Constructor and Description |
|---|
StandardSession(short version,
ByteBufferPool bufferPool,
Executor threadPool,
ScheduledExecutorService scheduler,
Controller<StandardSession.FrameBytes> controller,
IdleListener idleListener,
int initialStreamId,
SessionFrameListener listener,
Generator generator) |
| 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 |
completed(StandardSession.FrameBytes frameBytes)
Callback invoked when the operation completes.
|
<C> void |
control(IStream stream,
ControlFrame frame,
long timeout,
TimeUnit unit,
Handler<C> handler,
C context) |
<C> void |
data(IStream stream,
DataInfo dataInfo,
long timeout,
TimeUnit unit,
Handler<C> handler,
C context) |
void |
failed(Throwable x)
Callback invoked when the operation fails.
|
void |
flush()
Initiates the flush of data to the other peer.
|
List<Stream> |
getStreams() |
short |
getVersion() |
int |
getWindowSize() |
Future<Void> |
goAway()
Closes gracefully this session, sending a GO_AWAY frame and then closing the TCP connection.
|
void |
goAway(long timeout,
TimeUnit unit,
Handler<Void> handler)
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) |
Future<PingInfo> |
ping()
Sends asynchronously a PING, normally to measure round-trip time.
|
void |
ping(long timeout,
TimeUnit unit,
Handler<PingInfo> handler)
Sends asynchronously a PING, normally to measure round-trip time.
|
void |
removeListener(Session.Listener listener)
Deregisters the give
listener from being notified of session events. |
Future<Void> |
rst(RstInfo rstInfo)
Sends asynchronously a RST_STREAM to abort a stream.
|
void |
rst(RstInfo rstInfo,
long timeout,
TimeUnit unit,
Handler<Void> handler)
Sends asynchronously a RST_STREAM to abort a stream.
|
Future<Void> |
settings(SettingsInfo settingsInfo)
Sends asynchronously a SETTINGS to configure the SPDY connection.
|
void |
settings(SettingsInfo settingsInfo,
long timeout,
TimeUnit unit,
Handler<Void> handler)
Sends asynchronously a SETTINGS to configure the SPDY connection.
|
Future<Stream> |
syn(SynInfo synInfo,
StreamFrameListener listener)
Sends asynchronously a SYN_FRAME to create a new
SPDY stream. |
void |
syn(SynInfo synInfo,
StreamFrameListener listener,
long timeout,
TimeUnit unit,
Handler<Stream> handler)
Sends asynchronously a SYN_FRAME to create a new
SPDY stream. |
protected void |
write(ByteBuffer buffer,
Handler<StandardSession.FrameBytes> handler,
StandardSession.FrameBytes frameBytes) |
public StandardSession(short version,
ByteBufferPool bufferPool,
Executor threadPool,
ScheduledExecutorService scheduler,
Controller<StandardSession.FrameBytes> controller,
IdleListener idleListener,
int initialStreamId,
SessionFrameListener listener,
Generator generator)
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 Future<Stream> syn(SynInfo synInfo, StreamFrameListener listener)
SessionSends asynchronously a SYN_FRAME to create a new SPDY stream.
Callers may use the returned future to wait for the stream to be 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 createdSession.syn(SynInfo, StreamFrameListener, long, TimeUnit, Handler)public void syn(SynInfo synInfo, StreamFrameListener listener, long timeout, TimeUnit unit, Handler<Stream> handler)
SessionSends asynchronously a SYN_FRAME to create a new SPDY stream.
Callers may pass a non-null completion handler 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 createdtimeout - the operation's timeoutunit - the timeout's unithandler - the completion handler that gets notified of stream creationSession.syn(SynInfo, StreamFrameListener)public Future<Void> rst(RstInfo rstInfo)
SessionSends asynchronously a RST_STREAM to abort a stream.
Callers may use the returned future to wait for the reset to be sent.
rst in interface SessionrstInfo - the metadata to reset the streamSession.rst(RstInfo, long, TimeUnit, Handler)public void rst(RstInfo rstInfo, long timeout, TimeUnit unit, Handler<Void> handler)
SessionSends asynchronously a RST_STREAM to abort a stream.
Callers may pass a non-null completion handler to be notified of when the reset has been actually sent.
rst in interface SessionrstInfo - the metadata to reset the streamtimeout - the operation's timeoutunit - the timeout's unithandler - the completion handler that gets notified of reset's sendSession.rst(RstInfo)public Future<Void> settings(SettingsInfo settingsInfo)
SessionSends asynchronously a SETTINGS to configure the SPDY connection.
Callers may use the returned future to wait for the settings to be sent.
settings in interface SessionsettingsInfo - the metadata to sendSession.settings(SettingsInfo, long, TimeUnit, Handler)public void settings(SettingsInfo settingsInfo, long timeout, TimeUnit unit, Handler<Void> handler)
SessionSends asynchronously a SETTINGS to configure the SPDY connection.
Callers may pass a non-null completion handler to be notified of when the settings has been actually sent.
settings in interface SessionsettingsInfo - the metadata to sendtimeout - the operation's timeoutunit - the timeout's unithandler - the completion handler that gets notified of settings' sendSession.settings(SettingsInfo)public Future<PingInfo> ping()
SessionSends asynchronously a PING, normally to measure round-trip time.
Callers may use the returned future to wait for the ping to be sent.
ping in interface SessionSession.ping(long, TimeUnit, Handler)public void ping(long timeout,
TimeUnit unit,
Handler<PingInfo> handler)
SessionSends asynchronously a PING, normally to measure round-trip time.
Callers may pass a non-null completion handler to be notified of when the ping has been actually sent.
ping in interface Sessiontimeout - the operation's timeoutunit - the timeout's unithandler - the completion handler that gets notified of ping's sendSession.ping()public Future<Void> goAway()
SessionCloses gracefully this session, sending a GO_AWAY frame and then closing the TCP connection.
Callers may use the returned future to wait for the go away to be sent.
goAway in interface SessionSession.goAway(long, TimeUnit, Handler)public void goAway(long timeout,
TimeUnit unit,
Handler<Void> handler)
SessionCloses gracefully this session, sending a GO_AWAY frame and then closing the TCP connection.
Callers may pass a non-null completion handler to be notified of when the go away has been actually sent.
goAway in interface Sessiontimeout - the operation's timeoutunit - the timeout's unithandler - the completion handler that gets notified of go away's sendSession.goAway()public List<Stream> getStreams()
getStreams 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 <C> void control(IStream stream, ControlFrame frame, long timeout, TimeUnit unit, Handler<C> handler, C context)
public <C> void data(IStream stream, DataInfo dataInfo, long timeout, TimeUnit unit, Handler<C> handler, C context)
public int getWindowSize()
getWindowSize in interface ISessionpublic void flush()
ISessionInitiates the flush of data to the other peer.
Note that the flush may do nothing if, for example, there is nothing to flush, or if the data to be flushed belong to streams that have their flow-control stalled.
public void completed(StandardSession.FrameBytes frameBytes)
HandlerCallback invoked when the operation completes.
completed in interface Handler<StandardSession.FrameBytes>frameBytes - the contextHandler.failed(Throwable)public void failed(Throwable x)
HandlerCallback invoked when the operation fails.
failed in interface Handler<StandardSession.FrameBytes>x - the reason for the operation failureprotected void write(ByteBuffer buffer, Handler<StandardSession.FrameBytes> handler, StandardSession.FrameBytes frameBytes)
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.