Package org.rribbit.execution
Interface ListenerObjectExecutor
- All Known Implementing Classes:
AbstractListenerObjectExecutor
,MultiThreadedListenerObjectExecutor
,SequentialListenerObjectExecutor
public interface ListenerObjectExecutor
This interface specifies a method that can execute a set of
ListenerObject
s and return the results.- Author:
- G.J. Schouten
-
Method Summary
Modifier and TypeMethodDescription<T> Response
<T> executeListeners
(Collection<ListenerObject> listenerObjects, Object... parameters) Executes allListenerObject
s in the givenCollection
and gives the return values back.
-
Method Details
-
executeListeners
Executes allListenerObject
s in the givenCollection
and gives the return values back. There is no guarantee on the ordering of the results. This means that implementations can use any execution order they like. The number ofListenerObject
that are executed may be larger than the number of return values that is returned, because someListenerObject
s may return nothing (void). Also note that someListenerObject
s in the 'listenerObjects'Collection
may not match the parameters in the 'parameters' array. Implementation need to take this into account and provide proper error handling. When aListenerObject
does not match the parameterObject
s, it is to be ignored and not to be incorporated into the results. Generally, the most efficient way of checking this is to just try to call invoke() on theMethod
of theListenerObject
. If anyException
other thanInvocationTargetException
occurs, it will probably mean that the parameters will not match theMethod
. AnInvocationTargetException
means that there was a successful invocation, but aThrowable
was thrown from the method itself.- Parameters:
listenerObjects
- theListenerObject
s that have to be executedparameters
- the parameters to give to theListenerObject
s- Returns:
- the
Response
object representing the response of this execution - Throws:
IllegalArgumentException
- when 'listenerObjects' is 'null'
-