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 ListenerObjects in parallel Threads. 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 Threads to execute the ListenerObjects 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
Constructors -
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:AbstractListenerObjectExecutorThis method should callAbstractListenerObjectExecutor.executeSingleListenerObject(ListenerObject, Object...)on eachListenerObject, accumulate the results, and return. Typical implementations do this either sequentially, or multi-threaded.- Specified by:
doExecuteListenersin classAbstractListenerObjectExecutor- Parameters:
listenerObjects-parameters-- Returns:
- a
Collectionwith theAbstractListenerObjectExecutor.ExecutionResults of the givenListenerObjects or an emptyCollectionif there are no results, never returns null
-