public class PipeDuplexHandler<RCV_UP,RCV_DOWN,SND_UP,SND_DOWN> extends Object implements PipeDuplex<RCV_UP,RCV_DOWN,SND_UP,SND_DOWN>
PipeDuplexHandler`s in opposite directions can to PipeDuplexPipeDuplex| 构造器和说明 |
|---|
PipeDuplexHandler(PipeHandler<RCV_UP,RCV_DOWN> decoder,
PipeHandler<SND_UP,SND_DOWN> encoder) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
onActive(PipeContext context)
when the Connected.
|
void |
onClose(PipeContext context)
release protocol stack, connection close.
|
PipeStatus |
onError(PipeContext context,
boolean isRcv,
Throwable e,
PipeExceptionHolder eh)
Gets called if a Throwable was thrown.
|
void |
onInit(PipeContext context)
Initialize the protocol stack.
|
PipeStatus |
onMessage(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.
|
public PipeDuplexHandler(PipeHandler<RCV_UP,RCV_DOWN> decoder, PipeHandler<SND_UP,SND_DOWN> encoder)
public void onInit(PipeContext context) throws Throwable
PipeDuplexpublic void onActive(PipeContext context) throws Throwable
PipeDuplexpublic PipeStatus onMessage(PipeContext context, boolean isRcv, PipeRcvQueue<RCV_UP> rcvUp, PipeSndQueue<RCV_DOWN> rcvDown, PipeRcvQueue<SND_UP> sndUp, PipeSndQueue<SND_DOWN> sndDown) throws Throwable
PipeDuplexPipeRcvQueue.rcvSubmit()/PipeSndQueue.sndSubmit() method of (RCV_UP, RCV_DOWN, SND_UP, SND_DOWN) will be called.
PipeDuplex.onError(PipeContext, boolean, Throwable, PipeExceptionHolder).public PipeStatus onError(PipeContext context, boolean isRcv, Throwable e, PipeExceptionHolder eh) throws Throwable
PipeDuplexPipeRcvQueue.rcvReset()/PipeSndQueue.sndReset() method of (RCV_UP, RCV_DOWN, SND_UP, SND_DOWN) will be called
... -> onMessage -> onMessage -> Exception
|
onError -> onError -> onError...
You can clear the exception flag with the PipeExceptionHolder.clear() method, and piple execution will continue normally
... -> onMessage -> onError -> onError(invoker clear) -> onMessage -> ...
public void onClose(PipeContext context)
PipeDuplexCopyright © 2022–2024. All rights reserved.