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.
G.J. Schouten
  • Method Details

    • executeListeners

      <T> Response<T> executeListeners(Collection<ListenerObject> listenerObjects, Object... parameters)
      Executes all ListenerObjects in the given Collection 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 of ListenerObject that are executed may be larger than the number of return values that is returned, because some ListenerObjects may return nothing (void).

      Also note that some ListenerObjects 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 a ListenerObject does not match the parameter Objects, 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 the Method of the ListenerObject. If any Exception other than InvocationTargetException occurs, it will probably mean that the parameters will not match the Method. An InvocationTargetException means that there was a successful invocation, but a Throwable was thrown from the method itself.

      listenerObjects - the ListenerObjects that have to be executed
      parameters - the parameters to give to the ListenerObjects
      the Response object representing the response of this execution
      IllegalArgumentException - when 'listenerObjects' is 'null'