public class ListenerQueue<K,V,E> extends Object
ListenerQueue objects are created as necessary to build a list of listeners that should receive a specific event or events. Once the list is created, the event can then be synchronously or asynchronously delivered to the list of listeners. After the event has been dispatched for delivery, the ListenerQueue object should be discarded as it is likely the list of listeners is stale. A new ListenerQueue object should be created when it is time to deliver another event. The Sets used to build the list of listeners must not change after being added to the list.
Modifier and Type | Field and Description |
---|---|
protected EventManager |
manager
EventManager with which this queue is associated.
|
Constructor and Description |
---|
ListenerQueue(EventManager manager)
ListenerQueue constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
dispatchEventAsynchronous(int eventAction,
E eventObject)
Asynchronously dispatch an event to the snapshot list.
|
void |
dispatchEventSynchronous(int eventAction,
E eventObject)
Synchronously dispatch an event to the snapshot list.
|
void |
queueListeners(EventListeners<K,V> listeners,
EventDispatcher<K,V,E> dispatcher)
Deprecated.
As of 3.5. Replaced by
queueListeners(Set, EventDispatcher) . |
void |
queueListeners(Set<Map.Entry<K,V>> listeners,
EventDispatcher<K,V,E> dispatcher)
Add a set of listeners to the snapshot list.
|
protected final EventManager manager
public ListenerQueue(EventManager manager)
manager
- The EventManager this queue is associated with.IllegalArgumentException
- If manager is null.public void queueListeners(EventListeners<K,V> listeners, EventDispatcher<K,V,E> dispatcher)
queueListeners(Set, EventDispatcher)
.listeners
- An EventListeners object to add to the queue. The current listeners
in the EventListeners object will be called when an event is dispatched.dispatcher
- An EventDispatcher object to use when dispatching an event
to the listeners on the specified EventListeners.IllegalStateException
- If called after one of the dispatch methods has been called.public void queueListeners(Set<Map.Entry<K,V>> listeners, EventDispatcher<K,V,E> dispatcher)
listeners
- A Set of Map.Entries to add to the queue. This is typically the entrySet
from a CopyOnWriteIdentityMap object. This set must not change after being added to this
snapshot list.dispatcher
- An EventDispatcher object to use when dispatching an event
to the specified listeners.IllegalStateException
- If called after one of the dispatch methods has been called.public void dispatchEventAsynchronous(int eventAction, E eventObject)
eventAction
- This value is passed to the EventDispatcher.eventObject
- This object is passed to the EventDispatcher.public void dispatchEventSynchronous(int eventAction, E eventObject)
eventAction
- This value is passed to the EventDispatcher.eventObject
- This object is passed to the EventDispatcher.Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.