Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.context.event
Class SimpleApplicationEventMulticaster

    java.lang.Object
      org.springframework.context.event.AbstractApplicationEventMulticaster
          org.springframework.context.event.SimpleApplicationEventMulticaster

All Implemented Interfaces:
  Aware, BeanFactoryAware, ApplicationEventMulticaster

    public class SimpleApplicationEventMulticaster

extends AbstractApplicationEventMulticaster

Simple implementation of the `ApplicationEventMulticaster` interface.

Multicasts all events to all registered listeners, leaving it up to the listeners to ignore events that they are not interested in. Listeners will usually perform corresponding `instanceof` checks on the passed-in event object.

By default, all listeners are invoked in the calling thread. This allows the danger of a rogue listener blocking the entire application, but adds minimal overhead. Specify an alternative TaskExecutor to have listeners executed in different threads, for example from a thread pool.

Author:
  Rod Johnson, Juergen Hoeller
See Also:
  `setTaskExecutor(java.util.concurrent.Executor)`

Constructor Summary
`SimpleApplicationEventMulticaster()` Create a new SimpleApplicationEventMulticaster.
`SimpleApplicationEventMulticaster(BeanFactory beanFactory)` Create a new SimpleApplicationEventMulticaster for the given BeanFactory.

Method Summary
`protected java.util.concurrent.Executor` | `getTaskExecutor()` Return the current TaskExecutor for this multicaster.
`void` | `multicastEvent(ApplicationEvent event)` Multicast the given application event to appropriate listeners.
`void` | `setTaskExecutor(java.util.concurrent.Executor taskExecutor)` Set the TaskExecutor to execute application listeners with.

Methods inherited from class org.springframework.context.event.AbstractApplicationEventMulticaster
`addApplicationListener, addApplicationListenerBean, getApplicationListeners, getApplicationListeners, removeAllListeners, removeApplicationListener, removeApplicationListenerBean, setBeanFactory, supportsEvent`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SimpleApplicationEventMulticaster

    public SimpleApplicationEventMulticaster()

  Create a new SimpleApplicationEventMulticaster.

### SimpleApplicationEventMulticaster

    public SimpleApplicationEventMulticaster(BeanFactory beanFactory)

  Create a new SimpleApplicationEventMulticaster for the given BeanFactory.

Method Detail

### setTaskExecutor

    public void setTaskExecutor(java.util.concurrent.Executor taskExecutor)

  Set the TaskExecutor to execute application listeners with.

  Default is a SyncTaskExecutor, executing the listeners synchronously in the calling thread.

  Consider specifying an asynchronous TaskExecutor here to not block the caller until all listeners have been executed. However, note that asynchronous execution will not participate in the caller's thread context (class loader, transaction association) unless the TaskExecutor explicitly supports this.

  See Also:
    `SyncTaskExecutor`, `SimpleAsyncTaskExecutor`

### getTaskExecutor

    protected java.util.concurrent.Executor getTaskExecutor()

  Return the current TaskExecutor for this multicaster.

### multicastEvent

    public void multicastEvent(ApplicationEvent event)

  Description copied from interface: `ApplicationEventMulticaster`
  Multicast the given application event to appropriate listeners.

  Parameters:
    `event` - the event to multicast

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD