@FunctionalInterface public interface PipeLayer<RCV_UP,RCV_DOWN,SND_UP,SND_DOWN>
PipeLayer RCV_DOWN -> next PipeLayer RCV_UP
┏━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┏━━━━━━━━━━━━━━━━━━━━━━━━━┓
DATA -> ┃ RCV_UP RCV_DOWN ┃ -> ┃ RCV_UP RCV_DOWN ┃ -> ...
┃ ┃ ┃ ┃
┃ PipeLayer (1) ┃ ┃ PipeLayer (2) ┃
┃ ┃ ┃ ┃
... <- ┃ SND_DOWN SND_UP ┃ <- ┃ SND_DOWN SND_UP ┃ <- DATA
┗━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┗━━━━━━━━━━━━━━━━━━━━━━━━━┛
This design means that during any rcv/snd, upstream and downstream of the pipeline can be operated.
PipeHandler,
PipeConfig| 限定符和类型 | 方法和说明 |
|---|---|
default PipeStatus |
doError(PipeContext context,
boolean isRcv,
Throwable e,
PipeExceptionHolder eh)
Gets called if a Throwable was thrown.
|
PipeStatus |
doLayer(PipeContext context,
boolean isRcv,
PipeRcvQueue<RCV_UP> rcvUp,
PipeSndQueue<RCV_DOWN> rcvDown,
PipeRcvQueue<SND_UP> sndUp,
PipeSndQueue<SND_DOWN> sndDown)
process data the protocol stack.
|
default void |
init(PipeContext context)
Initialize the protocol stack, when the Connected.
|
default void |
release(PipeContext context)
release protocol stack, connection close.
|
default void init(PipeContext context) throws Throwable
ThrowablePipeStatus doLayer(PipeContext context, boolean isRcv, PipeRcvQueue<RCV_UP> rcvUp, PipeSndQueue<RCV_DOWN> rcvDown, PipeRcvQueue<SND_UP> sndUp, PipeSndQueue<SND_DOWN> sndDown) throws Throwable
PipeRcvQueue.rcvSubmit()/PipeSndQueue.sndSubmit() method of (RCV_UP, RCV_DOWN, SND_UP, SND_DOWN) will be called.
doError(PipeContext, boolean, Throwable, PipeExceptionHolder).Throwabledefault PipeStatus doError(PipeContext context, boolean isRcv, Throwable e, PipeExceptionHolder eh) throws Throwable
PipeRcvQueue.rcvReset()/PipeSndQueue.sndReset() method of (RCV_UP, RCV_DOWN, SND_UP, SND_DOWN) will be called
... -> doLayer -> doLayer -> Exception
|
doError -> doError -> doError...
You can clear the exception flag with the PipeExceptionHolder.clear() method, and piple execution will continue normally
... -> doLayer -> doError -> doError(invoker clear) -> doLayer -> ...
Throwabledefault void release(PipeContext context)
Copyright © 2022–2024. All rights reserved.