org.springframework.context.event
Class ApplicationEventMulticasterImpl
- public class ApplicationEventMulticasterImpl
- implements ApplicationEventMulticaster
Concrete implementation of ApplicationEventMulticaster
Doesn't permit multiple instances of the same listener.
Note that this class doesn't try to do anything clever to ensure thread
safety if listeners are added or removed at runtime. A technique such as
Copy-on-Write (Lea:137) could be used to ensure this, but the assumption in
this version of this framework is that listeners will be added at application
configuration time and not added or removed as the application runs.
All listeners are invoked in the calling thread. This allows the danger of
a rogue listener blocking the entire application, but adds minimal overhead.
An alternative implementation could be more sophisticated in both these respects.
- Author:
- Rod Johnson
addApplicationListener
public void addApplicationListener(ApplicationListener l)
onApplicationEvent
public void onApplicationEvent(ApplicationEvent e)
removeAllListeners
public void removeAllListeners()
removeApplicationListener
public void removeApplicationListener(ApplicationListener l)
to Class java.util.Set- Set of listeners