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.StreamListener
Parser.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 Session
public void addListener(Session.Listener listener)
Session
Registers the given listener
to be notified of session events.
addListener
in interface Session
listener
- the listener to registerSession.removeListener(Listener)
public void removeListener(Session.Listener listener)
Session
Deregisters the give listener
from being notified of session events.
removeListener
in interface Session
listener
- the listener to deregisterSession.addListener(Listener)
public Stream syn(SynInfo synInfo, StreamFrameListener listener) throws ExecutionException, InterruptedException, TimeoutException
Session
Sends a SYN_FRAME to create a new SPDY stream
.
Callers may use the returned Stream for example, to send data frames.
syn
in interface Session
synInfo
- the metadata to send on stream creationlistener
- the listener to invoke when events happen on the stream just createdExecutionException
InterruptedException
TimeoutException
Session.syn(SynInfo, StreamFrameListener, Promise)
public void syn(SynInfo synInfo, StreamFrameListener listener, Promise<Stream> promise)
Session
Sends 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 Session
synInfo
- 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
Session
Sends synchronously a RST_STREAM to abort a stream.
rst
in interface Session
rstInfo
- the metadata to reset the streamInterruptedException
ExecutionException
TimeoutException
Session.rst(RstInfo, Callback)
public void rst(RstInfo rstInfo, Callback callback)
Session
Sends 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 Session
rstInfo
- 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
Session
Sends synchronously a SETTINGS to configure the SPDY connection.
settings
in interface Session
settingsInfo
- the metadata to sendExecutionException
InterruptedException
TimeoutException
Session.settings(SettingsInfo, Callback)
public void settings(SettingsInfo settingsInfo, Callback callback)
Session
Sends 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 Session
settingsInfo
- the metadata to sendcallback
- the completion callback that gets notified of settings' sendSession.settings(SettingsInfo)
public PingResultInfo ping(PingInfo pingInfo) throws ExecutionException, InterruptedException, TimeoutException
Session
Sends synchronously a PING, normally to measure round-trip time.
ping
in interface Session
ExecutionException
InterruptedException
TimeoutException
Session.ping(PingInfo, Promise)
public void ping(PingInfo pingInfo, Promise<PingResultInfo> promise)
Session
Sends 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 Session
promise
- the completion callback that gets notified of ping's sendSession.ping(PingInfo)
public void goAway(GoAwayInfo goAwayInfo) throws ExecutionException, InterruptedException, TimeoutException
Session
Closes gracefully this session, sending a GO_AWAY frame and then closing the TCP connection.
goAway
in interface Session
ExecutionException
InterruptedException
TimeoutException
Session.goAway(GoAwayInfo, Callback)
public void goAway(GoAwayInfo goAwayInfo, Callback callback)
Session
Closes 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 Session
callback
- the completion callback that gets notified of go away's sendSession.goAway(GoAwayInfo)
public Set<Stream> getStreams()
getStreams
in interface Session
Session.getStream(int)
public IStream getStream(int streamId)
getStream
in interface Session
streamId
- the id of the stream to retrieveSession.getStreams()
public Object getAttribute(String key)
getAttribute
in interface Session
key
- the attribute keySession.setAttribute(String, Object)
public void setAttribute(String key, Object value)
setAttribute
in interface Session
key
- 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 Session
key
- the attribute keySession.setAttribute(String, Object)
public InetSocketAddress getLocalAddress()
getLocalAddress
in interface Session
public InetSocketAddress getRemoteAddress()
getRemoteAddress
in interface Session
public void onControlFrame(ControlFrame frame)
onControlFrame
in interface Parser.Listener
public void onDataFrame(DataFrame frame, ByteBuffer data)
onDataFrame
in interface Parser.Listener
public void onStreamException(StreamException x)
onStreamException
in interface Parser.Listener
public void onSessionException(SessionException x)
onSessionException
in interface Parser.Listener
protected 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()
ISession
Gracefully 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 Dumpable
IOException
Copyright © 1995-2015 Webtide. All Rights Reserved.