receiver every time a ByteBuffer is read from
the receiver part.
The sender stream writer,
when available, can be used to write to the sender part.
The writerLoop is invoked whenever the writer part becomes unblocked, and
writing can be resumed.
API Note
The creator of the stream pair (typically Http3Connection) is expected
to complete the futureReceiverStream() completable future when the remote
part of the stream pair is created by the remote peer. This class will not
listen directly for creation of new remote streams.
The QueuingStreamPair class is a subclass of this class which
implements a writer loop over an unbounded queue of ByteBuffer, and
can be used when unlimited buffering of data for writing is not an issue.
| Modifier and Type | Class and Description |
|---|---|
| public static interface |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final Logger | |
| pack-priv final UniStreamPair. | |
| private volatile CompletableFuture | |
| private final Http3Streams. | |
| private volatile QuicStreamWriter | |
| private final SequentialScheduler | |
| private final ReentrantLock | |
| pack-priv volatile QuicStreamReader | |
| pack-priv final SequentialScheduler | |
| private final CompletableFuture | |
| private final QuicConnection | |
| private final Consumer | |
| private final Http3Streams. | |
| private final CompletableFuture | |
| private final CompletableFuture |
| Access | Constructor and Description |
|---|---|
| public | UniStreamPair(Http3Streams.
the HTTP/3 stream type streamType,the underlying Quic connection quicConnection, Consumer<ByteBuffer> the receiver callback receiver, Runnable the writer loop writerLoop, UniStreamPair.the error handler invoked in case of read errors errorHandler,the debug logger logger)Creates a new |
| pack-priv | UniStreamPair(Http3Streams.
the HTTP/3 stream type streamType,the underlying Quic connection quicConnection, Consumer<ByteBuffer> the receiver callback receiver, UniStreamPair.the error handler invoked in case
of read or write errors errorHandler,A constructor used by the |
| private | UniStreamPair(Http3Streams.
|
| Modifier and Type | Method and Description |
|---|---|
| private QuicStreamReader | Returns: the peer control stream readerthe peer control stream peerControlStream)Connects the peer control stream reader and
schedules the receiving of the peer settings from the given
|
| public CompletableFuture | Returns: a completable future that will be completed with the receiver part of this stream pair after the remote HTTP/3 stream type has been read off the remote initiated streamReturns a completable future that will be completed with the receiver part of this stream pair after the remote HTTP/3 stream type has been read off the remote initiated stream. |
| public final CompletableFuture | Returns: a completable future that will be completed with a reader connected to the receiver part of this stream pair after the remote HTTP/3 stream type has been read off the remote initiated streamReturns a completable future that will be completed with a reader connected to the receiver part of this stream pair after the remote HTTP/3 stream type has been read off the remote initiated stream. |
| public CompletableFuture | Returns: a completable future that will be completed with the sender part of this stream pair after the local HTTP/3 stream type has been queued for writing on the writing queueReturns a completable future that will be completed with the sender part of this stream pair after the local HTTP/3 stream type has been queued for writing on the writing queue. |
| public final CompletableFuture | Returns: a completable future that will be completed with a writer connected to the sender part of this stream pair after the local HTTP/3 stream type has been queued for writing on the writing queueReturns a completable future that will be completed with a writer connected to the sender part of this stream pair after the local HTTP/3 stream type has been queued for writing on the writing queue. |
| private static Http3Streams. | |
| private CompletableFuture | Returns: a completable future that will be completed with the local sender streamCreates the local sender stream and queues the stream type code in its writer queue. |
| public final Http3Streams. | Returns: the HTTP/3 stream type of the sender part of the stream pairReturns the HTTP/3 stream type of the sender part of the stream pair. |
| public QuicStreamWriter | Returns: the writer connected to the sender part of this stream ornull if no writer is connected yetReturns the writer connected to the sender part of this stream or
|
| pack-priv void | localWriterLoop()
This method is overridden by |
| public SequentialScheduler | Returns: the scheduler for the local writer loopReturns the scheduler for the local writer loop. |
| private QuicSenderStream | Returns: the givenstreama new local unidirectional stream stream, int the code to queue up on the stream writer queue code)Queues the given HTTP/3 stream type code on the given local unidirectional stream writer queue. |
| private void | |
| private void | processPeerControlBytes(ByteBuffer
the bytes received buffer)This method is called to process bytes received on the peer control stream. |
| private static Http3Streams. | |
| public final Http3Streams. | Returns: the HTTP/3 stream type of the receiver part of the stream pairReturns the HTTP/3 stream type of the receiver part of the stream pair. |
| private CompletableFuture | Returns: a completable future that will be completed with theQuicStreamReader allowing to read from the remote control
stream.Schedules the receiving of server settings |
| private CompletableFuture | Returns: a completable future that will be completed with theQuicStreamWriter allowing to write to the local control
streamSchedules sending of client settings. |
| public void | |
| pack-priv QuicStreamWriter | Returns: a writer that can be safely used.the downstream writer writer)Used by subclasses to redirect queuing of data to the subclass queue. |
| debug | back to summary |
|---|---|
| pack-priv final Logger debug | |
| errorHandler | back to summary |
|---|---|
| pack-priv final UniStreamPair. | |
| localSenderStreamCF | back to summary |
|---|---|
| private volatile CompletableFuture<QuicSenderStream> localSenderStreamCF | |
| localStreamType | back to summary |
|---|---|
| private final Http3Streams. | |
| localWriter | back to summary |
|---|---|
| private volatile QuicStreamWriter localWriter | |
| localWriteScheduler | back to summary |
|---|---|
| private final SequentialScheduler localWriteScheduler | |
| lock | back to summary |
|---|---|
| private final ReentrantLock lock | |
| peerReader | back to summary |
|---|---|
| pack-priv volatile QuicStreamReader peerReader | |
| peerReadScheduler | back to summary |
|---|---|
| pack-priv final SequentialScheduler peerReadScheduler | |
| peerReceiverStreamCF | back to summary |
|---|---|
| private final CompletableFuture<QuicReceiverStream> peerReceiverStreamCF | |
| quicConnection | back to summary |
|---|---|
| private final QuicConnection quicConnection | |
| receiver | back to summary |
|---|---|
| private final Consumer<ByteBuffer> receiver | |
| remoteStreamType | back to summary |
|---|---|
| private final Http3Streams. | |
| streamReaderCF | back to summary |
|---|---|
| private final CompletableFuture<QuicStreamReader> streamReaderCF | |
| streamWriterCF | back to summary |
|---|---|
| private final CompletableFuture<QuicStreamWriter> streamWriterCF | |
| UniStreamPair | back to summary |
|---|---|
| public UniStreamPair(Http3Streams. Creates a new
This class implements a read loop that will call the given
Writing to the sender part can be done by interacting directly with
the writer. If the writer is blocked due to flow control, and becomes
unblocked again, the
| |
| UniStreamPair | back to summary |
|---|---|
| pack-priv UniStreamPair(Http3Streams. A constructor used by the
| |
| UniStreamPair | back to summary |
|---|---|
| private UniStreamPair(Http3Streams. | |
| connectReceiverStream | back to summary |
|---|---|
| private QuicStreamReader connectReceiverStream(QuicReceiverStream peerControlStream) Connects the peer control stream reader and
schedules the receiving of the peer settings from the given
| |
| futureReceiverStream | back to summary |
|---|---|
| public CompletableFuture Returns a completable future that will be completed with the receiver part of this stream pair after the remote HTTP/3 stream type has been read off the remote initiated stream.
| |
| futureReceiverStreamReader | back to summary |
|---|---|
| public final CompletableFuture Returns a completable future that will be completed with a reader connected to the receiver part of this stream pair after the remote HTTP/3 stream type has been read off the remote initiated stream.
| |
| futureSenderStream | back to summary |
|---|---|
| public CompletableFuture Returns a completable future that will be completed with the sender part of this stream pair after the local HTTP/3 stream type has been queued for writing on the writing queue.
| |
| futureSenderStreamWriter | back to summary |
|---|---|
| public final CompletableFuture Returns a completable future that will be completed with a writer connected to the sender part of this stream pair after the local HTTP/3 stream type has been queued for writing on the writing queue.
| |
| local | back to summary |
|---|---|
| private static Http3Streams. | |
| localSenderStream | back to summary |
|---|---|
| private CompletableFuture Creates the local sender stream and queues the stream type code in its writer queue.
| |
| localStreamType | back to summary |
|---|---|
| public final Http3Streams. Returns the HTTP/3 stream type of the sender part of the stream pair.
| |
| localWriter | back to summary |
|---|---|
| public QuicStreamWriter localWriter() Returns the writer connected to the sender part of this stream or
| |
| localWriterLoop | back to summary |
|---|---|
| pack-priv void localWriterLoop() This method is overridden by | |
| localWriteScheduler | back to summary |
|---|---|
| public SequentialScheduler localWriteScheduler() Returns the scheduler for the local writer loop.
| |
| openLocalStream | back to summary |
|---|---|
| private QuicSenderStream openLocalStream(QuicSenderStream stream, int code) Queues the given HTTP/3 stream type code on the given local unidirectional stream writer queue.
| |
| peerReaderLoop | back to summary |
|---|---|
| private void peerReaderLoop() | |
| processPeerControlBytes | back to summary |
|---|---|
| private void processPeerControlBytes(ByteBuffer buffer) This method is called to process bytes received on the peer control stream.
| |
| remote | back to summary |
|---|---|
| private static Http3Streams. | |
| remoteStreamType | back to summary |
|---|---|
| public final Http3Streams. Returns the HTTP/3 stream type of the receiver part of the stream pair.
| |
| startReceiving | back to summary |
|---|---|
| private CompletableFuture Schedules the receiving of server settings
| |
| startSending | back to summary |
|---|---|
| private CompletableFuture Schedules sending of client settings.
| |
| stopSchedulers | back to summary |
|---|---|
| public void stopSchedulers() Stops schedulers. Can be called when the connection is closed to stop the reading and writing loops. | |
| wrap | back to summary |
|---|---|
| pack-priv QuicStreamWriter wrap(QuicStreamWriter writer) Used by subclasses to redirect queuing of data to the subclass queue.
| |
| Modifier and Type | Method and Description |
|---|---|
| public void | onError(QuicStream
the stream on which the error occurred stream, UniStreamPair the UniStreamPair to which the stream belongs uniStreamPair, Throwable the error that occurred error)Will be invoked when there is an error on a |
| onError | back to summary |
|---|---|
| public void onError(QuicStream stream, UniStreamPair uniStreamPair, Throwable error) Will be invoked when there is an error on a
| |