Stream.Listener
Callback.Completable, Callback.Completing, Callback.Nested
Invocable.InvocationType
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.atomic.AtomicReference<java.lang.Object> |
attachment |
private java.util.concurrent.atomic.AtomicReference<java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.Object>> |
attributes |
private java.util.concurrent.atomic.AtomicReference<CloseState> |
closeState |
private long |
dataLength |
private Stream.Listener |
listener |
private boolean |
local |
private boolean |
localReset |
private static Logger |
LOG |
private java.util.concurrent.atomic.AtomicInteger |
recvWindow |
private boolean |
remoteReset |
private java.util.concurrent.atomic.AtomicInteger |
sendWindow |
private ISession |
session |
private int |
streamId |
private long |
timeStamp |
private java.util.concurrent.atomic.AtomicReference<Callback> |
writing |
__nonBlocking
Constructor and Description |
---|
HTTP2Stream(Scheduler scheduler,
ISession session,
int streamId,
boolean local) |
Modifier and Type | Method and Description |
---|---|
private java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.Object> |
attributes() |
void |
close()
Forcibly closes this stream.
|
void |
data(DataFrame frame,
Callback callback)
Sends the given DATA
frame . |
java.lang.String |
dump() |
void |
dump(java.lang.Appendable out,
java.lang.String indent)
Dump this object (and children) into an Appendable using the provided indent after any new lines.
|
private Callback |
endWrite() |
void |
failed(java.lang.Throwable x)
Callback invoked when the operation fails.
|
java.lang.Object |
getAttachment() |
java.lang.Object |
getAttribute(java.lang.String key) |
int |
getId() |
Stream.Listener |
getListener() |
int |
getRecvWindow() |
int |
getSendWindow() |
ISession |
getSession() |
void |
headers(HeadersFrame frame,
Callback callback)
Sends the given HEADERS
frame representing a HTTP response. |
boolean |
isClosed() |
boolean |
isLocal() |
boolean |
isLocallyClosed() |
boolean |
isOpen()
This abstract method should be called to check if idle timeouts
should still be checked.
|
boolean |
isRemotelyClosed() |
boolean |
isReset() |
private void |
notifyClosed(Stream stream) |
private void |
notifyData(Stream stream,
DataFrame frame,
Callback callback) |
private void |
notifyFailure(Stream stream,
FailureFrame frame,
Callback callback) |
private boolean |
notifyIdleTimeout(Stream stream,
java.lang.Throwable failure) |
private void |
notifyReset(Stream stream,
ResetFrame frame,
Callback callback) |
void |
onClose() |
private void |
onData(DataFrame frame,
Callback callback) |
private void |
onFailure(FailureFrame frame,
Callback callback) |
private void |
onHeaders(HeadersFrame frame,
Callback callback) |
protected void |
onIdleExpired(java.util.concurrent.TimeoutException timeout)
This abstract method is called when the idle timeout has expired.
|
private void |
onPush(PushPromiseFrame frame,
Callback callback) |
private void |
onReset(ResetFrame frame,
Callback callback) |
private void |
onWindowUpdate(WindowUpdateFrame frame,
Callback callback) |
void |
process(Frame frame,
Callback callback)
Processes the given
frame , belonging to this stream. |
void |
push(PushPromiseFrame frame,
Promise<Stream> promise,
Stream.Listener listener)
Sends the given PUSH_PROMISE
frame . |
java.lang.Object |
removeAttribute(java.lang.String key) |
void |
reset(ResetFrame frame,
Callback callback)
Sends the given RST_STREAM
frame . |
void |
setAttachment(java.lang.Object attachment)
Attaches the given object to this stream for later retrieval.
|
void |
setAttribute(java.lang.String key,
java.lang.Object value) |
void |
setListener(Stream.Listener listener) |
private boolean |
startWrite(Callback callback) |
void |
succeeded()
Callback invoked when the operation completes.
|
java.lang.String |
toString() |
boolean |
updateClose(boolean update,
CloseState.Event event)
Updates the close state of this stream.
|
private boolean |
updateCloseAfterReceived() |
private boolean |
updateCloseAfterSend() |
private boolean |
updateCloseBeforeSend() |
int |
updateRecvWindow(int delta)
Updates the stream receive window by the given
delta . |
int |
updateSendWindow(int delta)
Updates the stream send window by the given
delta . |
private void |
updateStreamCount(int deltaStream,
int deltaClosing) |
checkIdleTimeout, getIdleFor, getIdleTimeout, getScheduler, notIdle, onOpen, setIdleTimeout
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getIdleTimeout, setIdleTimeout
getInvocationType, getInvocationType, invokeNonBlocking, isNonBlockingInvocation
dump, dumpObject, dumpObjects, dumpSelf
private static final Logger LOG
private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> attachment
private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.Object>> attributes
private final java.util.concurrent.atomic.AtomicReference<CloseState> closeState
private final java.util.concurrent.atomic.AtomicReference<Callback> writing
private final java.util.concurrent.atomic.AtomicInteger sendWindow
private final java.util.concurrent.atomic.AtomicInteger recvWindow
private final long timeStamp
private final ISession session
private final int streamId
private final boolean local
private boolean localReset
private Stream.Listener listener
private boolean remoteReset
private long dataLength
public java.lang.Object getAttachment()
getAttachment
in interface IStream
IStream.setAttachment(Object)
public void setAttachment(java.lang.Object attachment)
IStream
setAttachment
in interface IStream
attachment
- the object to attach to this streampublic boolean isLocal()
public ISession getSession()
getSession
in interface Stream
getSession
in interface IStream
public void headers(HeadersFrame frame, Callback callback)
Stream
Sends the given HEADERS frame
representing a HTTP response.
public void push(PushPromiseFrame frame, Promise<Stream> promise, Stream.Listener listener)
Stream
Sends the given PUSH_PROMISE frame
.
public void data(DataFrame frame, Callback callback)
Stream
Sends the given DATA frame
.
public void reset(ResetFrame frame, Callback callback)
Stream
Sends the given RST_STREAM frame
.
private boolean startWrite(Callback callback)
public java.lang.Object getAttribute(java.lang.String key)
getAttribute
in interface Stream
key
- the attribute keyStream.setAttribute(String, Object)
public void setAttribute(java.lang.String key, java.lang.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 java.lang.Object removeAttribute(java.lang.String key)
removeAttribute
in interface Stream
key
- the attribute keyStream.setAttribute(String, Object)
public boolean isReset()
public boolean isClosed()
public boolean isRemotelyClosed()
isRemotelyClosed
in interface IStream
Stream.isClosed()
public boolean isLocallyClosed()
public boolean isOpen()
IdleTimeout
isOpen
in class IdleTimeout
protected void onIdleExpired(java.util.concurrent.TimeoutException timeout)
IdleTimeout
onIdleExpired
in class IdleTimeout
timeout
- a TimeoutExceptionprivate java.util.concurrent.ConcurrentMap<java.lang.String,java.lang.Object> attributes()
public Stream.Listener getListener()
getListener
in interface IStream
Stream.Listener
associated with this streamIStream.setListener(Stream.Listener)
public void setListener(Stream.Listener listener)
setListener
in interface IStream
listener
- the Stream.Listener
associated with this streamIStream.getListener()
public void process(Frame frame, Callback callback)
IStream
Processes the given frame
, belonging to this stream.
private void onHeaders(HeadersFrame frame, Callback callback)
private void onReset(ResetFrame frame, Callback callback)
private void onPush(PushPromiseFrame frame, Callback callback)
private void onWindowUpdate(WindowUpdateFrame frame, Callback callback)
private void onFailure(FailureFrame frame, Callback callback)
public boolean updateClose(boolean update, CloseState.Event event)
IStream
Updates the close state of this stream.
updateClose
in interface IStream
update
- whether to update the close stateevent
- the event that caused the close state updateprivate boolean updateCloseAfterReceived()
private boolean updateCloseBeforeSend()
private boolean updateCloseAfterSend()
public int getSendWindow()
public int getRecvWindow()
public int updateSendWindow(int delta)
IStream
Updates the stream send window by the given delta
.
updateSendWindow
in interface IStream
delta
- the delta value (positive or negative) to add to the stream send windowpublic int updateRecvWindow(int delta)
IStream
Updates the stream receive window by the given delta
.
updateRecvWindow
in interface IStream
delta
- the delta value (positive or negative) to add to the stream receive windowpublic void close()
IStream
Forcibly closes this stream.
public void onClose()
onClose
in class IdleTimeout
private void updateStreamCount(int deltaStream, int deltaClosing)
public void succeeded()
Callback
Callback invoked when the operation completes.
succeeded
in interface Callback
Callback.failed(Throwable)
public void failed(java.lang.Throwable x)
Callback
Callback invoked when the operation fails.
private Callback endWrite()
private void notifyReset(Stream stream, ResetFrame frame, Callback callback)
private boolean notifyIdleTimeout(Stream stream, java.lang.Throwable failure)
private void notifyFailure(Stream stream, FailureFrame frame, Callback callback)
private void notifyClosed(Stream stream)
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOException
Dumpable
public java.lang.String toString()
toString
in class java.lang.Object