Http2Stream.
The implementation is aligned with HTTP/2 requirements with regards to message flow control.
| Modifier and Type | Class and Description |
|---|---|
| private class | DefaultOutputSink.
Flush |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicInteger | |
| private BundleQueue | |
| private final Object | |
| private final Http2Session | |
| private volatile boolean | |
| private static final Logger | |
| private static final int | |
| pack-priv final TaskQueue | |
| private final Http2Stream | |
| private static final DefaultOutputSink. | |
| private Termination | |
| private final AtomicInteger | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| public boolean | |
| private int | Returns: the amount of data that may be written.check the provided size against the window size limit. size)The method is responsible for checking the current output window size. |
| public synchronized void | close()
Implements org. Closes the output sink by adding last DataFrame with the FIN flag to a queue. |
| private DefaultOutputSink. | createOutputQueueRecord(final Buffer data, final HttpContent httpContent, final DefaultOutputSink.
|
| public void | flush(final CompletionHandler<Http2Stream>
CompletionHandler to be notifiedImplements org. Flush |
| private void | flushToConnectionOutputSink(final List<Http2Frame> headerFrames, final CompletionHandler<WriteResult<K, L>> completionHandler, final MessageCloner<Buffer> messageCloner, final boolean sendFIN)
|
| private void | flushToConnectionOutputSink(final Buffer data, final DefaultOutputSink.
|
| private void | flushToConnectionOutputSink(final List<Http2Frame> headerFrames, final Buffer data, final CompletionHandler<WriteResult<K, L>> completionHandler, final MessageCloner<Buffer> messageCloner, final boolean sendFIN)
|
| public int | getUnflushedWritesCount()
Implements org. Returns: the number of writes (not bytes), that haven't reached network layer |
| public boolean | |
| private boolean | |
| private boolean | |
| public void | notifyWritePossible(final WriteHandler writeHandler)
Implements org.
|
| public void | onPeerWindowUpdate(final int
the delta. delta)Implements org. The method is called by HTTP2 Filter once WINDOW_UPDATE message comes for this |
| private Buffer | prepareDataToSend(final boolean isRecordNull, final boolean isLast, final Buffer data, final boolean isZeroSizeData)
|
| private void | |
| private int | |
| private void | sendTrailers(final CompletionHandler<WriteResult<K, L>> completionHandler, final HttpTrailer httpContent)
|
| private Buffer | |
| public synchronized void | terminate(final Termination terminationFlag)
Implements org. Unlike |
| public synchronized void | writeDownStream(final HttpPacket
HttpPacket to sendthe completionHandler, final MessageCloner<Buffer> CompletionHandler, which will be notified about write progress.the messageCloner)MessageCloner, which will be able to clone the message in case it can't be
completely written in the current thread.Implements org. Send an |
| private DefaultOutputSink. | writeDownStream0(final HttpPacket httpPacket, final FilterChainContext ctx, final CompletionHandler<WriteResult<K, L>> completionHandler, final MessageCloner<Buffer> messageCloner)
|
| private void |
| availStreamWindowSize | back to summary |
|---|---|
| private final AtomicInteger availStreamWindowSize | |
| flushHandlersQueue | back to summary |
|---|---|
| private BundleQueue<CompletionHandler<Http2Stream>> flushHandlersQueue | |
| flushHandlersSync | back to summary |
|---|---|
| private final Object flushHandlersSync | |
| http2Session | back to summary |
|---|---|
| private final Http2Session http2Session | |
| isLastFrameQueued | back to summary |
|---|---|
| private volatile boolean isLastFrameQueued | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| MAX_OUTPUT_QUEUE_SIZE | back to summary |
|---|---|
| private static final int MAX_OUTPUT_QUEUE_SIZE | |
| outputQueue | back to summary |
|---|---|
| pack-priv final TaskQueue<DefaultOutputSink. | |
| stream | back to summary |
|---|---|
| private final Http2Stream stream | |
| TERMINATING_QUEUE_RECORD | back to summary |
|---|---|
| private static final DefaultOutputSink. | |
| terminationFlag | back to summary |
|---|---|
| private Termination terminationFlag | |
| unflushedWritesCounter | back to summary |
|---|---|
| private final AtomicInteger unflushedWritesCounter | |
| ZERO_QUEUE_RECORD_SIZE | back to summary |
|---|---|
| private static final int ZERO_QUEUE_RECORD_SIZE | |
| DefaultOutputSink | back to summary |
|---|---|
| pack-priv DefaultOutputSink(final Http2Stream stream) | |
| addOutputQueueRecord | back to summary |
|---|---|
| private void addOutputQueueRecord(DefaultOutputSink. | |
| assertReady | back to summary |
|---|---|
| private void assertReady() throws IOException | |
| canWrite | back to summary |
|---|---|
| public boolean canWrite() Implements org.
| |
| checkOutputWindow | back to summary |
|---|---|
| private int checkOutputWindow(final long size) The method is responsible for checking the current output window size. The returned integer value is the size of the data, which could be sent now.
| |
| close | back to summary |
|---|---|
| public synchronized void close() Implements org. Closes the output sink by adding last DataFrame with the FIN flag to a queue. If the output sink is already closed - method does nothing.
| |
| createOutputQueueRecord | back to summary |
|---|---|
| private DefaultOutputSink. | |
| flush | back to summary |
|---|---|
| public void flush(final CompletionHandler<Http2Stream> completionHandler) Implements org. Flush
| |
| flushToConnectionOutputSink | back to summary |
|---|---|
| private void flushToConnectionOutputSink(final List<Http2Frame> headerFrames, final CompletionHandler<WriteResult<K, L>> completionHandler, final MessageCloner<Buffer> messageCloner, final boolean sendFIN) | |
| flushToConnectionOutputSink | back to summary |
|---|---|
| private void flushToConnectionOutputSink(final Buffer data, final DefaultOutputSink. | |
| flushToConnectionOutputSink | back to summary |
|---|---|
| private void flushToConnectionOutputSink(final List<Http2Frame> headerFrames, final Buffer data, final CompletionHandler<WriteResult<K, L>> completionHandler, final MessageCloner<Buffer> messageCloner, final boolean sendFIN) | |
| getUnflushedWritesCount | back to summary |
|---|---|
| public int getUnflushedWritesCount() Implements org.
| |
| isClosed | back to summary |
|---|---|
| public boolean isClosed() Implements org.
| |
| isTerminated | back to summary |
|---|---|
| private boolean isTerminated() | |
| isWantToWrite | back to summary |
|---|---|
| private boolean isWantToWrite() | |
| notifyWritePossible | back to summary |
|---|---|
| public void notifyWritePossible(final WriteHandler writeHandler) Implements org.
| |
| onPeerWindowUpdate | back to summary |
|---|---|
| public void onPeerWindowUpdate(final int delta) throws Http2StreamException Implements org. The method is called by HTTP2 Filter once WINDOW_UPDATE message comes for this
| |
| prepareDataToSend | back to summary |
|---|---|
| private Buffer prepareDataToSend(final boolean isRecordNull, final boolean isLast, final Buffer data, final boolean isZeroSizeData) | |
| releaseWriteQueueSpace | back to summary |
|---|---|
| private void releaseWriteQueueSpace(final int justSentBytes, final boolean isAtomic, final boolean isEndOfChunk) | |
| reserveWriteQueueSpace | back to summary |
|---|---|
| private int reserveWriteQueueSpace(final int spaceToReserve) | |
| sendTrailers | back to summary |
|---|---|
| private void sendTrailers(final CompletionHandler<WriteResult<K, L>> completionHandler, final HttpTrailer httpContent) | |
| splitOutputBufferIfNeeded | back to summary |
|---|---|
| private Buffer splitOutputBufferIfNeeded(final Buffer buffer, final int length) | |
| terminate | back to summary |
|---|---|
| public synchronized void terminate(final Termination terminationFlag) Implements org. Unlike
| |
| writeDownStream | back to summary |
|---|---|
| public synchronized void writeDownStream(final HttpPacket httpPacket, final FilterChainContext ctx, final CompletionHandler<WriteResult<K, L>> completionHandler, final MessageCloner<Buffer> messageCloner) throws IOException Implements org. Send an
| |
| writeDownStream0 | back to summary |
|---|---|
| private DefaultOutputSink. | |
| writeEmptyFin | back to summary |
|---|---|
| private void writeEmptyFin() | |
CompletionHandler, which will be passed on each Http2Stream write to make sure
the data reached the wires.
Usually FlushCompletionHandler is also used as a wrapper for custom CompletionHandler
provided by users.
The parent class has an internal state, so be careful with reuses of the same instance!
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | done0()
Overrides org. Notifies all flush handlers about the completition. |
| FlushCompletionHandler | back to summary |
|---|---|
| public FlushCompletionHandler(final CompletionHandler<WriteResult<K, L>> parentCompletionHandler) | |
| done0 | back to summary |
|---|---|
| protected void done0() Overrides org. Notifies all flush handlers about the completition.
| |
| Modifier and Type | Field and Description |
|---|---|
| private DefaultOutputSink. | |
| private boolean | |
| private final boolean | |
| private Source | |
| private final HttpTrailer |
| Access | Constructor and Description |
|---|---|
| public | OutputQueueRecord(final Source resource, final DefaultOutputSink.
|
| public | OutputQueueRecord(final Source resource, final DefaultOutputSink.
|
| Modifier and Type | Method and Description |
|---|---|
| public WriteResult | getCurrentResult()
Implements abstract org. Returns the current record result object. |
| private void | |
| public void | |
| public void | |
| public void | |
| private void | reset(final Source resource, final DefaultOutputSink.
|
| chunkedCompletionHandler | back to summary |
|---|---|
| private DefaultOutputSink. | |
| isLast | back to summary |
|---|---|
| private boolean isLast | |
| isZeroSizeData | back to summary |
|---|---|
| private final boolean isZeroSizeData | |
| resource | back to summary |
|---|---|
| private Source resource | |
| trailer | back to summary |
|---|---|
| private final HttpTrailer trailer | |
| OutputQueueRecord | back to summary |
|---|---|
| public OutputQueueRecord(final Source resource, final DefaultOutputSink. | |
| OutputQueueRecord | back to summary |
|---|---|
| public OutputQueueRecord(final Source resource, final DefaultOutputSink. | |
| getCurrentResult | back to summary |
|---|---|
| public WriteResult Implements abstract org. Doc from org. Returns the current record result object.
| |
| incChunksCounter | back to summary |
|---|---|
| private void incChunksCounter() | |
| notifyFailure | back to summary |
|---|---|
| public void notifyFailure(final Throwable e) Overrides org.
| |
| recycle | back to summary |
|---|---|
| public void recycle() Implements org.
| |
| release | back to summary |
|---|---|
| public void release() | |
| reset | back to summary |
|---|---|
| private void reset(final Source resource, final DefaultOutputSink. | |