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 booleanacceptOutbound(Object msg) Returnstrueif the given message should be handled.protected abstract voidmatchedWrite(HandlerContext ctx, A recipient, O msg, CompletableFuture<Void> future) Is called for each message of typeSimpleDuplexHandler.voidwrite(HandlerContext ctx, Address recipient, Object msg, CompletableFuture<Void> future) Gets called if aObjectwas send from the application to a recipient.Methods inherited from class org.drasyl.pipeline.SimpleInboundHandler
acceptEvent, acceptInbound, eventTriggered, matchedEventTriggered, matchedRead, readMethods inherited from class org.drasyl.pipeline.AddressHandlerAdapter
acceptAddressMethods 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:HandlerGets called if aObjectwas send from the application to a recipient.- Specified by:
writein interfaceHandler- Overrides:
writein 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
-