Package org.rribbit.execution
Class MultiThreadedListenerObjectExecutor
java.lang.Object
org.rribbit.execution.AbstractListenerObjectExecutor
org.rribbit.execution.MultiThreadedListenerObjectExecutor
- All Implemented Interfaces:
ListenerObjectExecutor
This
AbstractListenerObjectExecutor
executes the ListenerObject
s in parallel Thread
s. If there is only one ListenerObject
to be executed, then
it will be executed in the calling Thread
and no new Thread
will be created.
Please note that spawning new Thread
s to execute the ListenerObject
s will result in the loss of the transaction context. If the transaction context must be preserved,
either make sure that only a single ListenerObject
is executed or consider using the SequentialListenerObjectExecutor
.- Author:
- G.J. Schouten
-
Nested Class Summary
Nested classes/interfaces inherited from class org.rribbit.execution.AbstractListenerObjectExecutor
AbstractListenerObjectExecutor.ExecutionResult, AbstractListenerObjectExecutor.ObjectResult, AbstractListenerObjectExecutor.ThrowableResult, AbstractListenerObjectExecutor.VoidResult
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondoExecuteListeners
(Collection<ListenerObject> listenerObjects, Object... parameters) This method should callAbstractListenerObjectExecutor.executeSingleListenerObject(ListenerObject, Object...)
on eachListenerObject
, accumulate the results, and return.Methods inherited from class org.rribbit.execution.AbstractListenerObjectExecutor
executeListeners, executeSingleListenerObject
-
Constructor Details
-
MultiThreadedListenerObjectExecutor
public MultiThreadedListenerObjectExecutor()
-
-
Method Details
-
doExecuteListeners
protected Collection<AbstractListenerObjectExecutor.ExecutionResult> doExecuteListeners(Collection<ListenerObject> listenerObjects, Object... parameters) Description copied from class:AbstractListenerObjectExecutor
This method should callAbstractListenerObjectExecutor.executeSingleListenerObject(ListenerObject, Object...)
on eachListenerObject
, accumulate the results, and return. Typical implementations do this either sequentially, or multi-threaded.- Specified by:
doExecuteListeners
in classAbstractListenerObjectExecutor
- Parameters:
listenerObjects
-parameters
-- Returns:
- a
Collection
with theAbstractListenerObjectExecutor.ExecutionResult
s of the givenListenerObject
s or an emptyCollection
if there are no results, never returns null
-