Package org.eclipse.jetty.http2
Class HTTP2Stream
java.lang.Object
org.eclipse.jetty.io.IdleTimeout
org.eclipse.jetty.http2.HTTP2Stream
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Stream
,IStream
,org.eclipse.jetty.util.Attachable
,org.eclipse.jetty.util.Callback
,org.eclipse.jetty.util.component.Dumpable
,org.eclipse.jetty.util.thread.Invocable
public class HTTP2Stream
extends org.eclipse.jetty.io.IdleTimeout
implements IStream, org.eclipse.jetty.util.Callback, org.eclipse.jetty.util.component.Dumpable
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Callback
org.eclipse.jetty.util.Callback.Completable, org.eclipse.jetty.util.Callback.Completing, org.eclipse.jetty.util.Callback.Nested
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
org.eclipse.jetty.util.component.Dumpable.DumpableContainer
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
org.eclipse.jetty.util.thread.Invocable.InvocationType
Nested classes/interfaces inherited from interface org.eclipse.jetty.http2.IStream
IStream.FrameList
Nested classes/interfaces inherited from interface org.eclipse.jetty.http2.api.Stream
Stream.Listener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicReference
<Object> private final AtomicReference
<ConcurrentMap<String, Object>> private final AtomicReference
<CloseState> private boolean
private long
private Throwable
private Stream.Listener
private final boolean
private boolean
private static final org.eclipse.jetty.util.log.Logger
private final AtomicInteger
private boolean
private org.eclipse.jetty.util.Callback
private final AtomicInteger
private final ISession
private final int
private final long
Fields inherited from interface org.eclipse.jetty.util.Callback
NOOP
Fields inherited from interface org.eclipse.jetty.util.component.Dumpable
KEY
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking
-
Constructor Summary
ConstructorsConstructorDescriptionHTTP2Stream
(org.eclipse.jetty.util.thread.Scheduler scheduler, ISession session, int streamId, boolean local) -
Method Summary
Modifier and TypeMethodDescriptionprivate ConcurrentMap
<String, Object> void
close()
Forcibly closes this stream.void
commit()
Marks this stream as committed.void
Sends the given DATAframe
.dump()
void
dump
(Appendable out, String indent) private org.eclipse.jetty.util.Callback
endWrite()
void
getAttribute
(String key) int
getId()
org.eclipse.jetty.util.thread.Invocable.InvocationType
int
int
void
headers
(HeadersFrame frame, org.eclipse.jetty.util.Callback callback) Sends the given HEADERSframe
.boolean
isClosed()
boolean
private boolean
isFailed()
boolean
isLocal()
boolean
boolean
isOpen()
boolean
boolean
isReset()
boolean
private void
notifyClosed
(Stream stream) private void
notifyData
(Stream stream, DataFrame frame, org.eclipse.jetty.util.Callback callback) private void
notifyFailure
(Stream stream, FailureFrame frame, org.eclipse.jetty.util.Callback callback) private boolean
notifyIdleTimeout
(Stream stream, Throwable failure) private void
notifyNewStream
(Stream stream) private void
notifyReset
(Stream stream, ResetFrame frame, org.eclipse.jetty.util.Callback callback) void
onClose()
private void
private void
onFailure
(FailureFrame frame, org.eclipse.jetty.util.Callback callback) private void
onHeaders
(HeadersFrame frame, org.eclipse.jetty.util.Callback callback) protected void
onIdleExpired
(TimeoutException timeout) private void
onNewStream
(org.eclipse.jetty.util.Callback callback) private void
onPush
(PushPromiseFrame frame, org.eclipse.jetty.util.Callback callback) private void
onReset
(ResetFrame frame, org.eclipse.jetty.util.Callback callback) private void
onWindowUpdate
(WindowUpdateFrame frame, org.eclipse.jetty.util.Callback callback) void
Processes the givenframe
, belonging to this stream.void
push
(PushPromiseFrame frame, org.eclipse.jetty.util.Promise<Stream> promise, Stream.Listener listener) Sends the given PUSH_PROMISEframe
.removeAttribute
(String key) void
reset
(ResetFrame frame, org.eclipse.jetty.util.Callback callback) Sends the given RST_STREAMframe
.void
send
(IStream.FrameList frameList, org.eclipse.jetty.util.Callback callback) Sends the given list of frames.void
setAttachment
(Object attachment) void
setAttribute
(String key, Object value) void
setListener
(Stream.Listener listener) private boolean
startWrite
(org.eclipse.jetty.util.Callback callback) void
toString()
boolean
updateClose
(boolean update, CloseState.Event event) Updates the close state of this stream.private boolean
private boolean
private boolean
int
updateRecvWindow
(int delta) Updates the stream receive window by the givendelta
.int
updateSendWindow
(int delta) Updates the stream send window by the givendelta
.private void
updateStreamCount
(int deltaStream, int deltaClosing) Methods inherited from class org.eclipse.jetty.io.IdleTimeout
checkIdleTimeout, getIdleFor, getIdleTimeout, getScheduler, notIdle, onOpen, setIdleTimeout
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable
dumpSelf
Methods inherited from interface org.eclipse.jetty.http2.api.Stream
getIdleTimeout, setIdleTimeout
-
Field Details
-
LOG
private static final org.eclipse.jetty.util.log.Logger LOG -
attachment
-
attributes
-
closeState
-
sendWindow
-
recvWindow
-
timeStamp
private final long timeStamp -
session
-
streamId
private final int streamId -
local
private final boolean local -
sendCallback
private org.eclipse.jetty.util.Callback sendCallback -
failure
-
localReset
private boolean localReset -
remoteReset
private boolean remoteReset -
listener
-
dataLength
private long dataLength -
committed
private boolean committed
-
-
Constructor Details
-
HTTP2Stream
public HTTP2Stream(org.eclipse.jetty.util.thread.Scheduler scheduler, ISession session, int streamId, boolean local)
-
-
Method Details
-
getId
public int getId() -
getAttachment
- Specified by:
getAttachment
in interfaceorg.eclipse.jetty.util.Attachable
-
setAttachment
- Specified by:
setAttachment
in interfaceorg.eclipse.jetty.util.Attachable
-
isLocal
public boolean isLocal() -
getSession
- Specified by:
getSession
in interfaceIStream
- Specified by:
getSession
in interfaceStream
- Returns:
- the session this stream is associated to
-
send
Description copied from interface:IStream
Sends the given list of frames.
Typically used to send HTTP headers along with content and possibly trailers.
-
headers
Description copied from interface:Stream
Sends the given HEADERS
frame
.Typically used to send an HTTP response or to send the HTTP response trailers.
-
push
public void push(PushPromiseFrame frame, org.eclipse.jetty.util.Promise<Stream> promise, Stream.Listener listener) Description copied from interface:Stream
Sends the given PUSH_PROMISE
frame
. -
data
Description copied from interface:Stream
Sends the given DATA
frame
. -
reset
Description copied from interface:Stream
Sends the given RST_STREAM
frame
. -
startWrite
private boolean startWrite(org.eclipse.jetty.util.Callback callback) -
getAttribute
- Specified by:
getAttribute
in interfaceStream
- Parameters:
key
- the attribute key- Returns:
- an arbitrary object associated with the given key to this stream or null if no object can be found for the given key.
- See Also:
-
setAttribute
- Specified by:
setAttribute
in interfaceStream
- Parameters:
key
- the attribute keyvalue
- an arbitrary object to associate with the given key to this stream- See Also:
-
removeAttribute
- Specified by:
removeAttribute
in interfaceStream
- Parameters:
key
- the attribute key- Returns:
- the arbitrary object associated with the given key to this stream
- See Also:
-
isReset
public boolean isReset() -
isFailed
private boolean isFailed() -
isResetOrFailed
public boolean isResetOrFailed()- Specified by:
isResetOrFailed
in interfaceIStream
- Returns:
- whether this stream has been reset (locally or remotely) or has been failed
- See Also:
-
isClosed
public boolean isClosed() -
isRemotelyClosed
public boolean isRemotelyClosed()- Specified by:
isRemotelyClosed
in interfaceIStream
- Returns:
- whether the stream is closed remotely.
- See Also:
-
isLocallyClosed
public boolean isLocallyClosed() -
commit
public void commit()Description copied from interface:IStream
Marks this stream as committed. -
isCommitted
public boolean isCommitted()- Specified by:
isCommitted
in interfaceIStream
- Returns:
- whether bytes for this stream have been sent to the remote peer.
- See Also:
-
isOpen
public boolean isOpen()- Specified by:
isOpen
in classorg.eclipse.jetty.io.IdleTimeout
-
onIdleExpired
- Specified by:
onIdleExpired
in classorg.eclipse.jetty.io.IdleTimeout
-
attributes
-
getListener
- Specified by:
getListener
in interfaceIStream
- Returns:
- the
Stream.Listener
associated with this stream - See Also:
-
setListener
- Specified by:
setListener
in interfaceIStream
- Parameters:
listener
- theStream.Listener
associated with this stream- See Also:
-
process
Description copied from interface:IStream
Processes the given
frame
, belonging to this stream. -
onNewStream
private void onNewStream(org.eclipse.jetty.util.Callback callback) -
onHeaders
-
onData
-
onReset
-
onPush
-
onWindowUpdate
-
onFailure
-
updateClose
Description copied from interface:IStream
Updates the close state of this stream.
- Specified by:
updateClose
in interfaceIStream
- Parameters:
update
- whether to update the close stateevent
- the event that caused the close state update- Returns:
- whether the stream has been fully closed by this invocation
-
updateCloseAfterReceived
private boolean updateCloseAfterReceived() -
updateCloseBeforeSend
private boolean updateCloseBeforeSend() -
updateCloseAfterSend
private boolean updateCloseAfterSend() -
getSendWindow
public int getSendWindow() -
getRecvWindow
public int getRecvWindow() -
updateSendWindow
public int updateSendWindow(int delta) Description copied from interface:IStream
Updates the stream send window by the given
delta
.- Specified by:
updateSendWindow
in interfaceIStream
- Parameters:
delta
- the delta value (positive or negative) to add to the stream send window- Returns:
- the previous value of the stream send window
-
updateRecvWindow
public int updateRecvWindow(int delta) Description copied from interface:IStream
Updates the stream receive window by the given
delta
.- Specified by:
updateRecvWindow
in interfaceIStream
- Parameters:
delta
- the delta value (positive or negative) to add to the stream receive window- Returns:
- the previous value of the stream receive window
-
close
public void close()Description copied from interface:IStream
Forcibly closes this stream.
-
onClose
public void onClose()- Overrides:
onClose
in classorg.eclipse.jetty.io.IdleTimeout
-
updateStreamCount
private void updateStreamCount(int deltaStream, int deltaClosing) -
succeeded
public void succeeded()- Specified by:
succeeded
in interfaceorg.eclipse.jetty.util.Callback
-
failed
- Specified by:
failed
in interfaceorg.eclipse.jetty.util.Callback
-
getInvocationType
public org.eclipse.jetty.util.thread.Invocable.InvocationType getInvocationType()- Specified by:
getInvocationType
in interfaceorg.eclipse.jetty.util.thread.Invocable
-
endWrite
private org.eclipse.jetty.util.Callback endWrite() -
notifyNewStream
-
notifyData
-
notifyReset
-
notifyIdleTimeout
-
notifyFailure
private void notifyFailure(Stream stream, FailureFrame frame, org.eclipse.jetty.util.Callback callback) -
notifyClosed
-
dump
- Specified by:
dump
in interfaceorg.eclipse.jetty.util.component.Dumpable
-
dump
- Specified by:
dump
in interfaceorg.eclipse.jetty.util.component.Dumpable
- Throws:
IOException
-
toString
-