public final class EventPublisherImpl extends Object implements EventPublisher
The default implementation of the EventPublisher
interface.
One can customise the event listening by instantiating with custom
listener handlers
and the event dispatching through
EventDispatcher
. See the com.atlassian.event.spi
package
for more information.
ListenerHandler
,
EventDispatcher
Constructor and Description |
---|
EventPublisherImpl(EventDispatcher eventDispatcher,
ListenerHandlersConfiguration listenerHandlersConfiguration)
If you need to customise the asynchronous handling, you should use the
AsynchronousAbleEventDispatcher together with a custom executor. |
EventPublisherImpl(EventDispatcher eventDispatcher,
ListenerHandlersConfiguration listenerHandlersConfiguration,
com.atlassian.plugin.scope.ScopeManager scopeManager)
Inherits
EventPublisherImpl(EventDispatcher, ListenerHandlersConfiguration) and
allows injection of scope manager |
Modifier and Type | Method and Description |
---|---|
void |
publish(Object event)
The order in which registered listeners are invoked is predictable.
|
void |
register(Object listener)
Register a listener to receive events.
|
void |
unregister(Object listener)
Un-register a listener so that it will no longer receive events.
|
void |
unregisterAll()
Un-register all listeners that this registrar knows about.
|
public EventPublisherImpl(EventDispatcher eventDispatcher, ListenerHandlersConfiguration listenerHandlersConfiguration)
If you need to customise the asynchronous handling, you should use the
AsynchronousAbleEventDispatcher
together with a custom executor. You might
also want to have a look at using the EventThreadFactory
to keep the naming
of event threads consistent with the default naming of the Atlassian Event library.
eventDispatcher
- the event dispatcher to be used with the publisherlistenerHandlersConfiguration
- the list of listener handlers to be used with this publisherAsynchronousAbleEventDispatcher
,
EventThreadFactory
public EventPublisherImpl(EventDispatcher eventDispatcher, ListenerHandlersConfiguration listenerHandlersConfiguration, com.atlassian.plugin.scope.ScopeManager scopeManager)
EventPublisherImpl(EventDispatcher, ListenerHandlersConfiguration)
and
allows injection of scope managereventDispatcher
- the event dispatcher to be used with the publisherlistenerHandlersConfiguration
- the list of listener handlers to be used with this publisherscopeManager
- the scope managerAsynchronousAbleEventDispatcher
,
EventThreadFactory
,
ScopeManager
public void publish(Object event)
publish
in interface EventPublisher
event
- the event to publishpublic void register(Object listener)
EventListenerRegistrar
EventListener
annotation. Legacy
implementations may also support listeners which implement the now-deprecated
EventListener
interface.register
in interface EventListenerRegistrar
listener
- The listener that is being registeredannotation which can be used to indicate event listener methods
public void unregister(Object listener)
EventListenerRegistrar
unregister
in interface EventListenerRegistrar
listener
- The listener to un-registerpublic void unregisterAll()
EventListenerRegistrar
unregisterAll
in interface EventListenerRegistrar
Copyright © 2006-2016 Atlassian. All Rights Reserved.