Unlike Options.WRITE_TIMEOUT this only applies to blocking operations which can be helpful to prevent the worker pool from becoming saturated when clients stop responding.
When a timeout occurs, a WriteTimeoutException is thrown, and the
ServerConnection is closed.
| Modifier and Type | Class and Description |
|---|---|
| public static class | |
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final HttpHandler | |
| private final ConduitWrapper |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static BlockingWriteTimeoutHandler. | |
| public void | handleRequest(HttpServerExchange
the HTTP request/response exchange exchange)Implements io. Handle the request. |
| next | back to summary |
|---|---|
| private final HttpHandler next | |
| streamSinkConduitWrapper | back to summary |
|---|---|
| private final ConduitWrapper<StreamSinkConduit> streamSinkConduitWrapper | |
| BlockingWriteTimeoutHandler | back to summary |
|---|---|
| private BlockingWriteTimeoutHandler(HttpHandler next, Duration writeTimeout) | |
| builder | back to summary |
|---|---|
| public static BlockingWriteTimeoutHandler. | |
| handleRequest | back to summary |
|---|---|
| public void handleRequest(HttpServerExchange exchange) throws Exception Implements io. Doc from io. Handle the request.
| |
| Modifier and Type | Field and Description |
|---|---|
| private HttpHandler | |
| private Duration |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public HttpHandler | |
| public BlockingWriteTimeoutHandler. | |
| public BlockingWriteTimeoutHandler. |
| nextHandler | back to summary |
|---|---|
| private HttpHandler nextHandler | |
| writeTimeout | back to summary |
|---|---|
| private Duration writeTimeout | |
| Builder | back to summary |
|---|---|
| private Builder() | |
| build | back to summary |
|---|---|
| public HttpHandler build() | |
| nextHandler | back to summary |
|---|---|
| public BlockingWriteTimeoutHandler. | |
| writeTimeout | back to summary |
|---|---|
| public BlockingWriteTimeoutHandler. | |
| Modifier and Type | Field and Description |
|---|---|
| private final StreamSinkConduit | |
| private long | |
| private final ServerConnection | |
| private final long |
| Access | Constructor and Description |
|---|---|
| pack-priv | TimeoutStreamSinkConduit(StreamSinkConduit delegate, ServerConnection serverConnection, long timeoutNanos)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | awaitWritable()
Implements org. Block until this channel becomes writable again. |
| public void | awaitWritable(long
the time to wait duration, TimeUnit the time unit unit)Implements org. Block until this conduit becomes writable again, or until the timeout expires. |
| public boolean | |
| public XnioWorker | getWorker()
Implements org. Get the XNIO worker associated with this conduit. |
| public XnioIoThread | getWriteThread()
Implements org. Get the write thread for this conduit. |
| public boolean | isWriteResumed()
Implements org. Determine whether write notifications are currently enabled. |
| public boolean | isWriteShutdown()
Implements org. Determine whether writes have been fully shut down on this conduit. |
| private long | |
| private int | |
| private boolean | |
| public void | resumeWrites()
Implements org. Indicate that the conduit's |
| public void | setWriteReadyHandler(WriteReadyHandler
the filter to receive readiness notifications writeReadyHandler)Implements org. Set the handler which should receive readiness notifications. |
| public void | suspendWrites()
Implements org. Indicate that calling the conduit's |
| public void | terminateWrites()
Implements org. Signal that no more write data is forthcoming. |
| public long | transferFrom(FileChannel
the file to read from fileChannel, long the position within the file from which the transfer is to begin position, long the number of bytes to be transferred count)Implements org. Transfer bytes into this conduit from the given file. |
| public long | transferFrom(StreamSourceChannel
the source to read from streamSourceChannel, long the number of bytes to be transferred count, ByteBuffer the buffer to copy through. byteBuffer)Implements org. Transfers bytes from the given channel source. |
| public void | truncateWrites()
Implements org. Terminate writes and discard any outstanding write data. |
| public void | wakeupWrites()
Implements org. Indicate that the conduit's |
| public int | write(ByteBuffer
the buffer containing data to write byteBuffer)Implements org. Writes a sequence of bytes to this conduit from the given buffer. |
| public long | write(ByteBuffer[]
the buffers containing data to write byteBuffers, int the offset into the buffer array offset, int the number of buffers to write length)Implements org. Writes a sequence of bytes to this conduit from the given buffers. |
| public int | writeFinal(ByteBuffer
The data to write byteBuffer)Implements org. Writes some data to the conduit, with the same semantics as
|
| public long | writeFinal(ByteBuffer[]
The buffers from which bytes are to be retrieved byteBuffers, int The offset within the buffer array of the first buffer from
which bytes are to be retrieved; must be non-negative and no
larger than srcs.length offset, int The maximum number of buffers to be accessed; must be
non-negative and no larger than
srcs.length - offset length)Implements org. Writes some data to the conduit, with the same semantics as
|
| delegate | back to summary |
|---|---|
| private final StreamSinkConduit delegate | |
| remaining | back to summary |
|---|---|
| private long remaining | |
| serverConnection | back to summary |
|---|---|
| private final ServerConnection serverConnection | |
| timeoutNanos | back to summary |
|---|---|
| private final long timeoutNanos | |
| TimeoutStreamSinkConduit | back to summary |
|---|---|
| pack-priv TimeoutStreamSinkConduit(StreamSinkConduit delegate, ServerConnection serverConnection, long timeoutNanos) | |
| awaitWritable | back to summary |
|---|---|
| public void awaitWritable() throws IOException Implements org. Doc from org. Block until this channel becomes writable again. This method may return spuriously before the channel becomes writable.
| |
| awaitWritable | back to summary |
|---|---|
| public void awaitWritable(long duration, TimeUnit unit) throws IOException Implements org. Doc from org. Block until this conduit becomes writable again, or until the timeout expires. This method may return spuriously before the conduit becomes writable or the timeout expires.
| |
| flush | back to summary |
|---|---|
| public boolean flush() throws IOException Implements org. Doc from org. Flush out any unwritten, buffered output.
| |
| getWorker | back to summary |
|---|---|
| public XnioWorker getWorker() Implements org. Doc from org. Get the XNIO worker associated with this conduit.
| |
| getWriteThread | back to summary |
|---|---|
| public XnioIoThread getWriteThread() Implements org. Doc from org. Get the write thread for this conduit.
| |
| isWriteResumed | back to summary |
|---|---|
| public boolean isWriteResumed() Implements org. Doc from org. Determine whether write notifications are currently enabled.
| |
| isWriteShutdown | back to summary |
|---|---|
| public boolean isWriteShutdown() Implements org. Doc from org. Determine whether writes have been fully shut down on this conduit.
| |
| resetTimeoutIfWriteSucceeded | back to summary |
|---|---|
| private long resetTimeoutIfWriteSucceeded(long value) | |
| resetTimeoutIfWriteSucceeded | back to summary |
|---|---|
| private int resetTimeoutIfWriteSucceeded(int value) | |
| resetTimeoutIfWriteSucceeded | back to summary |
|---|---|
| private boolean resetTimeoutIfWriteSucceeded(boolean value) | |
| resumeWrites | back to summary |
|---|---|
| public void resumeWrites() Implements org. Doc from org. Indicate that the conduit's
| |
| setWriteReadyHandler | back to summary |
|---|---|
| public void setWriteReadyHandler(WriteReadyHandler writeReadyHandler) Implements org. Doc from org. Set the handler which should receive readiness notifications. A filter may pass this invocation on to the filter it wraps, or it may substitute itself.
| |
| suspendWrites | back to summary |
|---|---|
| public void suspendWrites() Implements org. Doc from org. Indicate that calling the conduit's
| |
| terminateWrites | back to summary |
|---|---|
| public void terminateWrites() throws IOException Implements org. Doc from org. Signal that no more write data is forthcoming. The conduit must be
| |
| transferFrom | back to summary |
|---|---|
| public long transferFrom(FileChannel fileChannel, long position, long count) throws IOException Implements org. Doc from org. Transfer bytes into this conduit from the given file.
| |
| transferFrom | back to summary |
|---|---|
| public long transferFrom(StreamSourceChannel streamSourceChannel, long count, ByteBuffer byteBuffer) throws IOException Implements org. Doc from org. Transfers bytes from the given channel source. On entry,
| |
| truncateWrites | back to summary |
|---|---|
| public void truncateWrites() throws IOException Implements org. Doc from org. Terminate writes and discard any outstanding write data. The conduit is terminated and flushed regardless of the outcome of this method.
| |
| wakeupWrites | back to summary |
|---|---|
| public void wakeupWrites() Implements org. Doc from org. Indicate that the conduit's
| |
| write | back to summary |
|---|---|
| public int write(ByteBuffer byteBuffer) throws IOException Implements org. Doc from org. Writes a sequence of bytes to this conduit from the given buffer.
| |
| write | back to summary |
|---|---|
| public long write(ByteBuffer[] byteBuffers, int offset, int length) throws IOException Implements org. Doc from org. Writes a sequence of bytes to this conduit from the given buffers.
| |
| writeFinal | back to summary |
|---|---|
| public int writeFinal(ByteBuffer byteBuffer) throws IOException Implements org. Doc from org. Writes some data to the conduit, with the same semantics as
| |
| writeFinal | back to summary |
|---|---|
| public long writeFinal(ByteBuffer[] byteBuffers, int offset, int length) throws IOException Implements org. Doc from org. Writes some data to the conduit, with the same semantics as
| |
| Modifier and Type | Field and Description |
|---|---|
| private final long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public StreamSinkConduit | wrap(ConduitFactory<StreamSinkConduit>
the original conduit factory, HttpServerExchange the in-flight HTTP exchange exchange)Implements io. Wrap the conduit. |
| timeoutNanoseconds | back to summary |
|---|---|
| private final long timeoutNanoseconds | |
| TimeoutStreamSinkConduitWrapper | back to summary |
|---|---|
| pack-priv TimeoutStreamSinkConduitWrapper(Duration writeTimeout) | |
| wrap | back to summary |
|---|---|
| public StreamSinkConduit wrap(ConduitFactory<StreamSinkConduit> factory, HttpServerExchange exchange) Implements io. Doc from io. Wrap the conduit. The wrapper should not return
| |