EndPoint#write(Callback, ByteBuffer...) by calling
EndPoint#flush(ByteBuffer...) until all content is written.
The abstract method onIncompleteFlush() is called when not all content has been written after a call to
flush and should organize for the completeWrite() method to be called when a subsequent call to flush
should be able to make more progress.
| Modifier and Type | Class and Description |
|---|---|
| private static class | WriteFlusher.CompletingState
In CompletingState WriteFlusher is flushing buffers that have not been fully written in write(). |
| private static class | WriteFlusher.FailedState
In FailedState no more operations are allowed. |
| private static class | WriteFlusher.IdleState
In IdleState WriteFlusher is idle and accepts new writes |
| public static interface | WriteFlusher.Listener
A listener of |
| private class | WriteFlusher.PendingState
In PendingState not all buffers could be written in one go. |
| private static class | WriteFlusher.State
State represents a State of WriteFlusher. |
| private static enum | |
| private static class | WriteFlusher.WritingState
In WritingState WriteFlusher is currently writing. |
| Modifier and Type | Field and Description |
|---|---|
| private static final WriteFlusher. | |
| private static final WriteFlusher. | |
| private static final EnumMap | |
| private static final WriteFlusher. | |
| private final EndPoint | |
| private final AtomicReference | |
| private static final boolean | |
| private static final ByteBuffer[] | |
| private static final Logger |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public void | completeWrite()
Complete a write that has not completed and that called |
| private void | |
| protected ByteBuffer[] | Returns: The unflushed buffers, or null if all flushedthe datagram channel to send the buffers to (used by QUIC and HTTP/3) address, ByteBuffer[] The buffers to flush buffers)Flushes the buffers iteratively until no progress is made. |
| public Invocable. | |
| pack-priv boolean | |
| pack-priv boolean | |
| public boolean | |
| private boolean | |
| private boolean | |
| public void | |
| public boolean | |
| protected abstract void | |
| public String | |
| public String | |
| private boolean | Returns: the previous state or null if the state transition failedthe expected current state previous,the desired new state nextTries to update the current state to the given new state. |
| public void | write(Callback
the callback to call on either failed or complete callback, ByteBuffer... the buffers to flush to the endpoint buffers)Tries to switch state to WRITING. |
| public void |
| __COMPLETING | back to summary |
|---|---|
| private static final WriteFlusher. | |
| __IDLE | back to summary |
|---|---|
| private static final WriteFlusher. | |
| __stateTransitions | back to summary |
|---|---|
| private static final EnumMap<WriteFlusher. | |
| __WRITING | back to summary |
|---|---|
| private static final WriteFlusher. | |
| _endPoint | back to summary |
|---|---|
| private final EndPoint _endPoint | |
| _state | back to summary |
|---|---|
| private final AtomicReference<WriteFlusher. | |
| DEBUG | back to summary |
|---|---|
| private static final boolean DEBUG | |
| EMPTY_BUFFERS | back to summary |
|---|---|
| private static final ByteBuffer[] EMPTY_BUFFERS | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| WriteFlusher | back to summary |
|---|---|
| protected WriteFlusher(EndPoint endPoint) | |
| completeWrite | back to summary |
|---|---|
| public void completeWrite() Complete a write that has not completed and that called | |
| fail | back to summary |
|---|---|
| private void fail(Callback callback, Throwable... suppressed) | |
| flush | back to summary |
|---|---|
| protected ByteBuffer[] flush(SocketAddress address, ByteBuffer[] buffers) throws IOException Flushes the buffers iteratively until no progress is made.
| |
| getCallbackInvocationType | back to summary |
|---|---|
| public Invocable. | |
| isFailed | back to summary |
|---|---|
| pack-priv boolean isFailed() | |
| isIdle | back to summary |
|---|---|
| pack-priv boolean isIdle() | |
| isPending | back to summary |
|---|---|
| public boolean isPending() | |
| isState | back to summary |
|---|---|
| private boolean isState(WriteFlusher. | |
| isTransitionAllowed | back to summary |
|---|---|
| private boolean isTransitionAllowed(WriteFlusher. | |
| onClose | back to summary |
|---|---|
| public void onClose() | |
| onFail | back to summary |
|---|---|
| public boolean onFail(Throwable cause) Notify the flusher of a failure | |
| onIncompleteFlush | back to summary |
|---|---|
| protected abstract void onIncompleteFlush() Abstract call to be implemented by specific WriteFlushers. It should schedule a call to | |
| toStateString | back to summary |
|---|---|
| public String toStateString() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| updateState | back to summary |
|---|---|
| private boolean updateState(WriteFlusher. Tries to update the current state to the given new state.
| |
| write | back to summary |
|---|---|
| public void write(Callback callback, ByteBuffer... buffers) throws WritePendingException Tries to switch state to WRITING. If successful it writes the given buffers to the EndPoint. If state transition
fails it will fail the callback and leave the WriteFlusher in a terminal FAILED state.
If not all buffers can be written in one go it creates a new
| |
| write | back to summary |
|---|---|
| public void write(Callback callback, SocketAddress address, ByteBuffer... buffers) throws WritePendingException | |
| Access | Constructor and Description |
|---|---|
| private |
| CompletingState | back to summary |
|---|---|
| private CompletingState() | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Throwable |
| _cause | back to summary |
|---|---|
| private final Throwable _cause | |
| FailedState | back to summary |
|---|---|
| private FailedState(Throwable cause) | |
| getCause | back to summary |
|---|---|
| public Throwable getCause() | |
| Access | Constructor and Description |
|---|---|
| private |
| IdleState | back to summary |
|---|---|
| private IdleState() | |
A listener of WriteFlusher events.
If implemented by a Connection class, the onFlushed(long) event will be delivered to it.
| Modifier and Type | Method and Description |
|---|---|
| public void | onFlushed(long
the number of bytes flushed bytes)Invoked when a |
| onFlushed | back to summary |
|---|---|
| public void onFlushed(long bytes) throws IOException Invoked when a This method may be invoked multiple times, for example when writing a large buffer: a first flush of bytes, then the connection became TCP congested, and a subsequent flush of bytes when the connection became writable again. This method is never invoked concurrently, but may be invoked by different threads, so implementations may not rely on thread-local variables. Implementations may throw an
| |
| Modifier and Type | Field and Description |
|---|---|
| private final SocketAddress | |
| private final ByteBuffer[] | |
| private final Callback |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv Invocable. |
| _address | back to summary |
|---|---|
| private final SocketAddress _address | |
| _buffers | back to summary |
|---|---|
| private final ByteBuffer[] _buffers | |
| _callback | back to summary |
|---|---|
| private final Callback _callback | |
| PendingState | back to summary |
|---|---|
| private PendingState(Callback callback, SocketAddress address, ByteBuffer[] buffers) | |
| getCallbackInvocationType | back to summary |
|---|---|
| pack-priv Invocable. | |
| Modifier and Type | Field and Description |
|---|---|
| private final WriteFlusher. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public WriteFlusher. | |
| public String |
| _type | back to summary |
|---|---|
| private final WriteFlusher. | |
| State | back to summary |
|---|---|
| private State(WriteFlusher. | |
| getType | back to summary |
|---|---|
| public WriteFlusher. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final WriteFlusher. | |
| public static final WriteFlusher. | |
| public static final WriteFlusher. | |
| public static final WriteFlusher. | |
| public static final WriteFlusher. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static WriteFlusher. | |
| public static WriteFlusher. |
| COMPLETING | back to summary |
|---|---|
| public static final WriteFlusher. | |
| FAILED | back to summary |
|---|---|
| public static final WriteFlusher. | |
| IDLE | back to summary |
|---|---|
| public static final WriteFlusher. | |
| PENDING | back to summary |
|---|---|
| public static final WriteFlusher. | |
| WRITING | back to summary |
|---|---|
| public static final WriteFlusher. | |
| StateType | back to summary |
|---|---|
| private StateType() | |
| valueOf | back to summary |
|---|---|
| public static WriteFlusher. | |
| values | back to summary |
|---|---|
| public static WriteFlusher. | |
| Access | Constructor and Description |
|---|---|
| private |
| WritingState | back to summary |
|---|---|
| private WritingState() | |