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
ListenerObjects and return the results.- Author:
- G.J. Schouten
-
Method Summary
Modifier and TypeMethodDescription<T> Response<T> executeListeners(Collection<ListenerObject> listenerObjects, Object... parameters) Executes allListenerObjects in the givenCollectionand gives the return values back.
-
Method Details
-
executeListeners
Executes allListenerObjects in the givenCollectionand 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 ofListenerObjectthat are executed may be larger than the number of return values that is returned, because someListenerObjects may return nothing (void). Also note that someListenerObjects in the 'listenerObjects'Collectionmay not match the parameters in the 'parameters' array. Implementation need to take this into account and provide proper error handling. When aListenerObjectdoes not match the parameterObjects, 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 theMethodof theListenerObject. If anyExceptionother thanInvocationTargetExceptionoccurs, it will probably mean that the parameters will not match theMethod. AnInvocationTargetExceptionmeans that there was a successful invocation, but aThrowablewas thrown from the method itself.- Parameters:
listenerObjects- theListenerObjects that have to be executedparameters- the parameters to give to theListenerObjects- Returns:
- the
Responseobject representing the response of this execution - Throws:
IllegalArgumentException- when 'listenerObjects' is 'null'
-