public class

SimpleApplicationEventMulticaster

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

Class Overview

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.

Summary

Public Constructors
SimpleApplicationEventMulticaster()
Create a new SimpleApplicationEventMulticaster.
SimpleApplicationEventMulticaster(BeanFactory beanFactory)
Create a new SimpleApplicationEventMulticaster for the given BeanFactory.
Public Methods
void multicastEvent(ApplicationEvent event)
void setTaskExecutor(Executor taskExecutor)
Set the TaskExecutor to execute application listeners with.
Protected Methods
Executor getTaskExecutor()
Return the current TaskExecutor for this multicaster.
[Expand]
Inherited Methods
From class org.springframework.context.event.AbstractApplicationEventMulticaster
From class java.lang.Object
From interface org.springframework.beans.factory.BeanFactoryAware
From interface org.springframework.context.event.ApplicationEventMulticaster

Public Constructors

public SimpleApplicationEventMulticaster ()

Create a new SimpleApplicationEventMulticaster.

public SimpleApplicationEventMulticaster (BeanFactory beanFactory)

Create a new SimpleApplicationEventMulticaster for the given BeanFactory.

Public Methods

public void multicastEvent (ApplicationEvent event)

public void setTaskExecutor (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.

Protected Methods

protected Executor getTaskExecutor ()

Return the current TaskExecutor for this multicaster.