|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.event.internal.EventPublisherImpl
public class EventPublisherImpl
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 Summary | |
---|---|
EventPublisherImpl(EventDispatcher eventDispatcher,
java.util.List<ListenerHandler> listenerHandlers)
This constructor lets you customise your event dispatcher. |
|
EventPublisherImpl(java.util.List<ListenerHandler> listenerHandlers)
This constructor manages synchronous and asynchronous events through the use of the AsynchronousAbleEventDispatcher . |
Method Summary | |
---|---|
void |
publish(java.lang.Object event)
Publish an event that will be consumed by all listeners which have registered to receive it. |
void |
publishEvent(Event event)
Publish an event that will be consumed by all listeners which have registered to receive it. |
void |
register(java.lang.Object listener)
Register a listener to receive events. |
void |
registerListener(java.lang.String listenerKey,
EventListener listener)
Register a listener to receive events. |
void |
unRegister(java.lang.Object listener)
Un-register a listener so that it will no longer receive events. |
void |
unregisterListener(java.lang.String listenerKey)
Un-register a listener so that it will no longer receive events. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EventPublisherImpl(java.util.List<ListenerHandler> listenerHandlers)
This constructor manages synchronous and asynchronous events through the use of the
AsynchronousAbleEventDispatcher
. This is used together with a
ThreadPoolExecutor
and a EventThreadFactory
The default values for the thread pool executor are:
CORE_POOL_SIZE
MAXIMUM_POOL_SIZE
KEEP_ALIVE_TIME
in seconds
listenerHandlers
- the list of listener handlers to be used with this publisherif you need to customise the
{@link com.atlassian.event.spi.EventDispatcher}
,
AsynchronousAbleEventDispatcher
,
ThreadPoolExecutor
,
EventThreadFactory
public EventPublisherImpl(EventDispatcher eventDispatcher, java.util.List<ListenerHandler> listenerHandlers)
This constructor lets you customise your event dispatcher. It is highly recommended to use the
other constructor
.
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 publisherlistenerHandlers
- the list of listener handlers to be used with this publisherEventPublisherImpl(java.util.List)
,
AsynchronousAbleEventDispatcher
,
EventThreadFactory
Method Detail |
---|
public void publish(java.lang.Object event)
EventPublisher
publish
in interface EventPublisher
event
- the event to publishpublic void register(java.lang.Object listener)
EventPublisher
register
in interface EventPublisher
listener
- The listener that is being registeredpublic void unRegister(java.lang.Object listener)
EventPublisher
unRegister
in interface EventPublisher
listener
- The listener to un-registerpublic void publishEvent(Event event)
EventManager
publishEvent
in interface EventManager
event
- the event to publishpublic void registerListener(java.lang.String listenerKey, EventListener listener)
EventManager
registerListener
in interface EventManager
listenerKey
- A unique key for this listener. If the listener is a plugin module, use the
module's complete keylistener
- The listener that is being registeredpublic void unregisterListener(java.lang.String listenerKey)
EventManager
unregisterListener
in interface EventManager
listenerKey
- the key under which the listener was registered.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |