public class OrderedEventDispatcher extends AbstractThreadPooledEventDispatcher implements ThreadPooledEventDispatcher, OrderedEventDispatcherMBean
EventDispatcherthat the events for the same session
occurs in the same order it was generated actually. It has synchronization
overhead compared to SimpleEventDispatcher, but it will be more
useful in most situations. See SimpleEventDispatcherfor its
shortness.
Please note that OrderedEventDispatcherdoes not guarantee read and
write events are fired in order, but it does guarantee that the same type of
events will be fired in order:
Set thread pool size (AbstractThreadPooledEventDispatcher.setThreadPoolSize(int)) and call
AbstractThreadPooledEventDispatcher.start()to activate this event dispatcher.
AbstractThreadPooledEventDispatcher.stop()is invoked if there are any remaining events to process for
this event dispatcher. They will be terminated when JVM exits because they
are daemon threads.AbstractThreadPooledEventDispatcher.AbstractWorkerworkers| Constructor and Description |
|---|
OrderedEventDispatcher()
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
fire(Event event)
Fires the specified session event.
|
int |
getWaitingEventSize()
Returns the number of session events that are still not dispatched to
SessionListeners. |
protected AbstractThreadPooledEventDispatcher.AbstractWorker |
newWorker() |
protected AbstractThreadPooledEventDispatcher.AbstractWorker |
removeWorker() |
flush, getThreadNamePrefix, getThreadPoolSize, getThreadPriority, isStarted, setThreadNamePrefix, setThreadPoolSize, setThreadPriority, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitflushpublic int getWaitingEventSize()
EventDispatcherSessionListeners.getWaitingEventSize in interface EventDispatchergetWaitingEventSize in interface EventDispatcherMBeanEventDispatcher.getWaitingEventSize()protected AbstractThreadPooledEventDispatcher.AbstractWorker newWorker()
newWorker in class AbstractThreadPooledEventDispatcherprotected AbstractThreadPooledEventDispatcher.AbstractWorker removeWorker()
removeWorker in class AbstractThreadPooledEventDispatcherpublic void fire(Event event)
EventDispatcherfire in interface EventDispatcherCopyright © 2004-2012 Trustin Lee. All Rights Reserved.