public class StandardStream extends IdleTimeout implements IStream
Callback.Adapter
Constructor and Description |
---|
StandardStream(int id,
byte priority,
ISession session,
IStream associatedStream,
Scheduler scheduler,
Promise<Stream> promise) |
Modifier and Type | Method and Description |
---|---|
void |
associate(IStream stream)
|
void |
data(DataInfo dataInfo)
Sends asynchronously a DATA frame on this stream.
|
void |
data(DataInfo dataInfo,
Callback callback)
Sends asynchronously a DATA frame on this stream.
|
void |
disassociate(IStream stream)
remove the given associated
IStream from this stream |
void |
failed(Throwable x)
Callback invoked when the operation fails.
|
IStream |
getAssociatedStream()
Overrides Stream.getAssociatedStream() to return an instance of IStream instead of Stream
|
Object |
getAttribute(String key) |
int |
getId() |
byte |
getPriority() |
Set<Stream> |
getPushedStreams() |
ISession |
getSession() |
StreamFrameListener |
getStreamFrameListener() |
int |
getWindowSize()
Senders of data frames need to know the current window size
to determine whether they can send more data.
|
void |
headers(HeadersInfo headersInfo)
Sends asynchronously a HEADER frame on this stream.
|
void |
headers(HeadersInfo headersInfo,
Callback callback)
Sends asynchronously a HEADER frame on this stream.
|
boolean |
isClosed() |
boolean |
isHalfClosed() |
boolean |
isOpen()
This abstract method should be called to check if idle timeouts
should still be checked.
|
boolean |
isReset() |
boolean |
isUnidirectional() |
protected void |
onIdleExpired(TimeoutException timeout)
This abstract method is called when the idle timeout has expired.
|
void |
process(ControlFrame frame)
Processes the given control frame,
for example by updating the stream's state or by calling listeners.
|
void |
process(DataInfo dataInfo)
Processes the given
dataInfo ,
for example by updating the stream's state or by calling listeners. |
Stream |
push(PushInfo pushInfo)
Initiate a unidirectional spdy pushstream associated to this stream asynchronously
|
void |
push(PushInfo pushInfo,
Promise<Stream> promise)
Initiate a unidirectional spdy pushstream associated to this stream asynchronously
|
Object |
removeAttribute(String key) |
void |
reply(ReplyInfo replyInfo)
Sends asynchronously a SYN_REPLY frame in response to a SYN_STREAM frame.
|
void |
reply(ReplyInfo replyInfo,
Callback callback)
Sends asynchronously a SYN_REPLY frame in response to a SYN_STREAM frame.
|
void |
setAttribute(String key,
Object value) |
void |
setStreamFrameListener(StreamFrameListener listener) |
void |
succeeded()
Callback invoked when the operation completes.
|
String |
toString() |
void |
updateCloseState(boolean close,
boolean local)
A stream can be open,
half closed or
closed and this method updates the close state
of this stream. |
void |
updateWindowSize(int delta)
Updates the window size for this stream by the given amount,
that can be positive or negative.
|
checkIdleTimeout, getIdleTimeout, getIdleTimestamp, notIdle, onClose, onOpen, setIdleTimeout
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getIdleTimeout, setIdleTimeout
public IStream getAssociatedStream()
IStream
Overrides Stream.getAssociatedStream() to return an instance of IStream instead of Stream
getAssociatedStream
in interface Stream
getAssociatedStream
in interface IStream
Stream.getAssociatedStream()
public Set<Stream> getPushedStreams()
getPushedStreams
in interface Stream
public void disassociate(IStream stream)
IStream
remove the given associated IStream
from this stream
disassociate
in interface IStream
stream
- the stream to be removedpublic byte getPriority()
getPriority
in interface Stream
protected void onIdleExpired(TimeoutException timeout)
IdleTimeout
onIdleExpired
in class IdleTimeout
timeout
- a TimeoutExceptionpublic boolean isOpen()
IdleTimeout
isOpen
in class IdleTimeout
public int getWindowSize()
IStream
Senders of data frames need to know the current window size to determine whether they can send more data.
getWindowSize
in interface IStream
IStream.updateWindowSize(int)
public void updateWindowSize(int delta)
IStream
Updates the window size for this stream by the given amount, that can be positive or negative.
Senders and recipients of data frames update the window size, respectively, with negative values and positive values.
updateWindowSize
in interface IStream
delta
- the signed amount the window size needs to be updatedIStream.getWindowSize()
public ISession getSession()
getSession
in interface Stream
public Object getAttribute(String key)
getAttribute
in interface Stream
key
- the attribute keyStream.setAttribute(String, Object)
public void setAttribute(String key, Object value)
setAttribute
in interface Stream
key
- the attribute keyvalue
- an arbitrary object to associate with the given key to this streamStream.getAttribute(String)
,
Stream.removeAttribute(String)
public Object removeAttribute(String key)
removeAttribute
in interface Stream
key
- the attribute keyStream.setAttribute(String, Object)
public void setStreamFrameListener(StreamFrameListener listener)
setStreamFrameListener
in interface IStream
listener
- the stream frame listener associated to this stream
as returned by SessionFrameListener.onSyn(Stream, SynInfo)
public StreamFrameListener getStreamFrameListener()
getStreamFrameListener
in interface IStream
public void updateCloseState(boolean close, boolean local)
IStream
A stream can be open, half closed
or
closed
and this method updates the close state
of this stream.
If the stream is open, calling this method with a value of true puts the stream into half closed state.
If the stream is half closed, calling this method with a value of true puts the stream into closed state.
updateCloseState
in interface IStream
close
- whether the close state should be updatedlocal
- whether the close is local or remotepublic void process(ControlFrame frame)
IStream
Processes the given control frame, for example by updating the stream's state or by calling listeners.
process
in interface IStream
frame
- the control frame to processIStream.process(DataInfo)
public void process(DataInfo dataInfo)
IStream
Processes the given dataInfo
,
for example by updating the stream's state or by calling listeners.
process
in interface IStream
dataInfo
- the DataInfo to processIStream.process(ControlFrame)
public void succeeded()
Callback
Callback invoked when the operation completes.
succeeded
in interface Callback
Callback.failed(Throwable)
public void failed(Throwable x)
Callback
Callback invoked when the operation fails.
public Stream push(PushInfo pushInfo) throws InterruptedException, ExecutionException, TimeoutException
Stream
Initiate a unidirectional spdy pushstream associated to this stream asynchronously
Callers may use the returned future to get the pushstream once it got created
push
in interface Stream
pushInfo
- the metadata to send on stream creationInterruptedException
ExecutionException
TimeoutException
Stream.push(PushInfo, Promise)
public void push(PushInfo pushInfo, Promise<Stream> promise)
Stream
Initiate a unidirectional spdy pushstream associated to this stream asynchronously
Callers may pass a non-null completion promise to be notified of when the pushstream has been established.
push
in interface Stream
pushInfo
- the metadata to send on stream creationpromise
- the completion promise that gets notified once the pushstream is establishedStream.push(PushInfo)
public void reply(ReplyInfo replyInfo) throws InterruptedException, ExecutionException, TimeoutException
Stream
Sends asynchronously a SYN_REPLY frame in response to a SYN_STREAM frame.
Callers may use the returned future to wait for the reply to be actually sent.
reply
in interface Stream
replyInfo
- the metadata to sendInterruptedException
ExecutionException
TimeoutException
Stream.reply(ReplyInfo, Callback)
,
SessionFrameListener.onSyn(Stream, SynInfo)
public void reply(ReplyInfo replyInfo, Callback callback)
Stream
Sends asynchronously a SYN_REPLY frame in response to a SYN_STREAM frame.
Callers may pass a non-null completion callback to be notified of when the reply has been actually sent.
reply
in interface Stream
replyInfo
- the metadata to sendcallback
- the completion callback that gets notified of reply sentStream.reply(ReplyInfo)
public void data(DataInfo dataInfo) throws InterruptedException, ExecutionException, TimeoutException
Stream
Sends asynchronously a DATA frame on this stream.
DATA frames should always be sent after a SYN_REPLY frame.
Callers may use the returned future to wait for the data to be actually sent.
data
in interface Stream
dataInfo
- the metadata to sendInterruptedException
ExecutionException
TimeoutException
Stream.data(DataInfo, Callback)
,
Stream.reply(ReplyInfo)
public void data(DataInfo dataInfo, Callback callback)
Stream
Sends asynchronously a DATA frame on this stream.
DATA frames should always be sent after a SYN_REPLY frame.
Callers may pass a non-null completion callback to be notified of when the data has been actually sent.
data
in interface Stream
dataInfo
- the metadata to sendcallback
- the completion callback that gets notified of data sentStream.data(DataInfo)
public void headers(HeadersInfo headersInfo) throws InterruptedException, ExecutionException, TimeoutException
Stream
Sends asynchronously a HEADER frame on this stream.
HEADERS frames should always be sent after a SYN_REPLY frame.
Callers may use the returned future to wait for the headers to be actually sent.
headers
in interface Stream
headersInfo
- the metadata to sendInterruptedException
ExecutionException
TimeoutException
Stream.headers(HeadersInfo, Callback)
,
Stream.reply(ReplyInfo)
public void headers(HeadersInfo headersInfo, Callback callback)
Stream
Sends asynchronously a HEADER frame on this stream.
HEADERS frames should always be sent after a SYN_REPLY frame.
Callers may pass a non-null completion callback to be notified of when the headers have been actually sent.
headers
in interface Stream
headersInfo
- the metadata to sendcallback
- the completion callback that gets notified of headers sentStream.headers(HeadersInfo)
public boolean isUnidirectional()
isUnidirectional
in interface Stream
public boolean isReset()
public boolean isHalfClosed()
isHalfClosed
in interface Stream
Stream.isClosed()
public boolean isClosed()
isClosed
in interface Stream
Stream.isHalfClosed()
Copyright © 1995-2015 Webtide. All Rights Reserved.