public class UnorderedParallelEventReceivingStrategy extends Object implements EventReceivingStrategy
EventReceivingStrategy
that dispatches Event
s using a
thread pool but without any ordering guarantees.Activatable.State
Constructor and Description |
---|
UnorderedParallelEventReceivingStrategy() |
Modifier and Type | Method and Description |
---|---|
void |
activate()
Activates all resources that belong to a specific object.
|
void |
addFilter(Filter filter)
Adds a filter that is applied for all registered handlers some time after
this method call.
|
void |
addHandler(Handler handler,
boolean wait)
Registers a handler that will be informed in case of received events.
|
void |
deactivate()
Deactivate all resources that are owned by a specific object in order to
correctly tear down.
|
void |
handle(Event event)
The callback method.
|
boolean |
isActive()
Tells whether this class is currently active or not.
|
void |
removeFilter(Filter filter)
Removes a filter that is remove for all registered handlers some time
after this method call.
|
void |
removeHandler(Handler handler,
boolean wait)
Removes a handler from the event dispatching.
|
public UnorderedParallelEventReceivingStrategy()
public void addFilter(Filter filter)
EventReceivingStrategy
addFilter
in interface EventReceivingStrategy
filter
- filter to add, not null
public void removeFilter(Filter filter)
EventReceivingStrategy
removeFilter
in interface EventReceivingStrategy
filter
- filter to remove, not null
public void addHandler(Handler handler, boolean wait)
EventReceivingStrategy
addHandler
in interface EventReceivingStrategy
handler
- the handler to add, not null
wait
- if true
, wait with returning from this method
until the handler is fully functional and will receive the
next issued eventpublic void removeHandler(Handler handler, boolean wait) throws InterruptedException
EventReceivingStrategy
removeHandler
in interface EventReceivingStrategy
handler
- the handler to removewait
- if true
, wait with returning from this method
until the handler cannot receive any more eventsInterruptedException
- interrupted while waiting for the handler to be removedpublic void handle(Event event)
EventHandler
handle
in interface EventHandler
event
- the event to handlepublic void deactivate() throws InterruptedException
Activatable
deactivate
in interface Activatable
InterruptedException
- thrown if waiting for shutdown was interrupted.public void activate() throws RSBException
Activatable
activate
in interface Activatable
RSBException
- generic error related to RSBpublic boolean isActive()
Activatable
isActive
in interface Activatable
true
if activeCopyright © 2018 CoR-Lab. All rights reserved.