public class SimpleEventDispatcher extends AbstractThreadPooledEventDispatcher implements ThreadPooledEventDispatcher, SimpleEventDispatcherMBean
EventDispatcherthat the events for the same session
does NOT occur in the same order it was generated actually.
That is, the events might come in random order (e.g.
messageReceived:SecondMessage,
connectionEstablished,messageReceived:FirstMessage
,
connectionClosed,messageReceived:ThirdMessage).
This dispatcher is appropriate for the case the order of event is not
important. If so, use OrderedEventDispatcherinstead.
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 |
|---|
SimpleEventDispatcher()
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.