public class MultiEventHandlerInvoker extends Object implements EventHandlerInvoker
EventHandlerInvoker with capabilities to invoke several different invokers.| Constructor and Description |
|---|
MultiEventHandlerInvoker(EventHandlerInvoker... delegates)
Initializes multi invoker with different invokers.
|
MultiEventHandlerInvoker(List<EventHandlerInvoker> delegates)
Initializes multi invoker with different invokers.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canHandle(EventMessage<?> eventMessage,
Segment segment)
Check whether or not this invoker has handlers that can handle the given
eventMessage for a given segment. |
boolean |
canHandleType(Class<?> payloadType)
Check whether or not this invoker has handlers that can handle the given
payloadType. |
List<EventHandlerInvoker> |
delegates() |
void |
handle(EventMessage<?> message,
Segment segment)
Handle the given
message for the given segment. |
void |
performReset()
Performs any activities that are required to reset the state managed by handlers assigned to this invoker.
|
<R> void |
performReset(R resetContext)
Performs any activities that are required to reset the state managed by handlers assigned to this invoker.
|
boolean |
supportsReset()
Indicates whether the handlers managed by this invoker support a reset.
|
public MultiEventHandlerInvoker(EventHandlerInvoker... delegates)
MultiEventHandlerInvoker will be
flattened.delegates - which will be used to do the actual event handlingpublic MultiEventHandlerInvoker(List<EventHandlerInvoker> delegates)
MultiEventHandlerInvoker will be
flattened.delegates - which will be used to do the actual event handlingpublic List<EventHandlerInvoker> delegates()
public boolean canHandle(EventMessage<?> eventMessage, Segment segment)
EventHandlerInvokereventMessage for a given segment.canHandle in interface EventHandlerInvokereventMessage - The message to be processedsegment - The segment for which the event handler should be invokedtrue if the invoker has one or more handlers that can handle the given message, false
otherwisepublic boolean canHandleType(Class<?> payloadType)
EventHandlerInvokerpayloadType.canHandleType in interface EventHandlerInvokerpayloadType - The payloadType of the message to be processedtrue if the invoker has one or more handlers that can handle the given message, false
otherwisepublic void handle(EventMessage<?> message, Segment segment) throws Exception
EventHandlerInvokermessage for the given segment.
Callers are recommended to invoke EventHandlerInvoker.canHandle(EventMessage, Segment) prior to invocation, but aren't
required to do so. Implementations must ensure to take the given segment into account when processing messages.
handle in interface EventHandlerInvokermessage - The message to handlesegment - The segment for which to handle the messageException - when an exception occurs while handling the messagepublic boolean supportsReset()
EventHandlerInvokersupportsReset in interface EventHandlerInvokertrue if a reset is supported, otherwise falsepublic void performReset()
EventHandlerInvokerperformReset in interface EventHandlerInvokerpublic <R> void performReset(R resetContext)
EventHandlerInvokerperformReset in interface EventHandlerInvokerR - the type of the provided resetContextresetContext - a R used to support the reset operationCopyright © 2010–2020. All rights reserved.