Class ServerChannel<REQ,RESP>
- Type Parameters:
REQ- the request message typeRESP- the response message type
- All Implemented Interfaces:
Channel
Channel backed by a Transport that receives requests and dispatches them to a
registered handler.
Two virtual threads drive the channel: a reader that decodes requests from the transport input stream and dispatches them to the registered handler, and a writer that drains the response queue and encodes responses to the transport output stream. When the handler completes the future provided by the reader, the response is enqueued for writing.
I/O and unexpected errors are routed to the ErrorHandler. If the handler returns
true (the default), the channel closes the transport and completes its close future
exceptionally. Return false to tolerate the error and continue processing. Unrecoverable
errors that bypass the inner I/O catch (e.g. RuntimeException) are caught by an outer
safety net that guarantees the close future always resolves.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class io.bytestreams.exchange.core.AbstractChannel
channelSpan, closeFuture, DEFAULT_ERROR_BACKOFF_NANOS, defaultTimeout, meterAttributes, readFuture, requestActive, requestDuration, requestErrors, requestTotal, SHUTTING_DOWN, status, transport, writeQueue, writeQueueSize -
Method Summary
Modifier and TypeMethodDescriptionstatic <REQ,RESP>
ServerChannel.Builder<REQ, RESP> builder()protected booleanprotected voidMethods inherited from class io.bytestreams.exchange.core.AbstractChannel
buildMessageAttributes, close, closeFuture, id, interruptIfDrained, start, status
-
Method Details
-
builder
-
onInbound
- Specified by:
onInboundin classAbstractChannel<RESP,REQ>
-
hasPending
protected boolean hasPending()- Specified by:
hasPendingin classAbstractChannel<RESP,REQ>
-