Package org.drasyl.pipeline
Interface Handler
-
- All Known Subinterfaces:
InboundHandler
,OutboundHandler
- All Known Implementing Classes:
DuplexHandler
,HandlerAdapter
,InboundHandlerAdapter
,OutboundHandlerAdapter
,SimpleInboundHandler
,SimpleOutboundHandler
,SimplexDuplexHandler
public interface Handler
Handles an I/O event or intercepts an I/O operation, and forwards it to its next handler in itsPipeline
.Sub-types
Handler
itself does not provide many methods, but you usually have to implement one of its subtypes:InboundHandler
to handle inbound I/O events, andOutboundHandler
to handle outbound I/O operations.
Alternatively, the following adapter classes are provided for your convenience:
InboundHandlerAdapter
to handle inbound I/O events,OutboundHandlerAdapter
to handle outbound I/O operations, andDuplexHandler
to handle both inbound and outbound events
The context object
A
Handler
is provided with aHandlerContext
object. AHandler
is supposed to interact with thePipeline
it belongs to via a context object. Using the context object, theHandler
can pass events upstream or downstream or modify the pipeline dynamically.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
handlerAdded(HandlerContext ctx)
Gets called after theHandler
was added to the actual context and it's ready to handle events.void
handlerRemoved(HandlerContext ctx)
Gets called after theHandler
was removed from the actual context and it doesn't handle events anymore.
-
-
-
Method Detail
-
handlerAdded
void handlerAdded(HandlerContext ctx)
Gets called after theHandler
was added to the actual context and it's ready to handle events.
-
handlerRemoved
void handlerRemoved(HandlerContext ctx)
Gets called after theHandler
was removed from the actual context and it doesn't handle events anymore.
-
-