Package org.drasyl.pipeline
Class SimpleDuplexHandler<I,E,O,A extends Address>
java.lang.Object
org.drasyl.pipeline.HandlerAdapter
org.drasyl.pipeline.AddressHandlerAdapter<A>
org.drasyl.pipeline.SimpleInboundHandler<I,E,A>
org.drasyl.pipeline.SimpleDuplexHandler<I,E,O,A>
- All Implemented Interfaces:
Handler
- Direct Known Subclasses:
Codec
public abstract class SimpleDuplexHandler<I,E,O,A extends Address>
extends SimpleInboundHandler<I,E,A>
HandlerAdapter
which allows to explicit only handle a specific type of messages and
events.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
acceptOutbound
(Object msg) Returnstrue
if the given message should be handled.protected abstract void
matchedWrite
(HandlerContext ctx, A recipient, O msg, CompletableFuture<Void> future) Is called for each message of typeSimpleDuplexHandler
.void
write
(HandlerContext ctx, Address recipient, Object msg, CompletableFuture<Void> future) Gets called if aObject
was send from the application to a recipient.Methods inherited from class org.drasyl.pipeline.SimpleInboundHandler
acceptEvent, acceptInbound, eventTriggered, matchedEventTriggered, matchedRead, read
Methods inherited from class org.drasyl.pipeline.AddressHandlerAdapter
acceptAddress
Methods inherited from class org.drasyl.pipeline.HandlerAdapter
exceptionCaught, handlerAdded, handlerRemoved
-
Constructor Details
-
SimpleDuplexHandler
protected SimpleDuplexHandler() -
SimpleDuplexHandler
-
-
Method Details
-
write
public void write(HandlerContext ctx, Address recipient, Object msg, CompletableFuture<Void> future) Description copied from interface:Handler
Gets called if aObject
was send from the application to a recipient.- Specified by:
write
in interfaceHandler
- Overrides:
write
in classHandlerAdapter
- Parameters:
ctx
- handler contextrecipient
- the recipient of the messagemsg
- the messagefuture
- a future for the message
-
acceptOutbound
-
matchedWrite
protected abstract void matchedWrite(HandlerContext ctx, A recipient, O msg, CompletableFuture<Void> future) Is called for each message of typeSimpleDuplexHandler
.- Parameters:
ctx
- handler contextrecipient
- the recipient of the messagemsg
- the messagefuture
- a future for the message
-