net.gleamynode.netty2
Class SimpleEventDispatcher
java.lang.Object
net.gleamynode.netty2.AbstractThreadPooledEventDispatcher
net.gleamynode.netty2.SimpleEventDispatcher
- All Implemented Interfaces:
- EventDispatcher, EventDispatcherMBean, SimpleEventDispatcherMBean, ThreadPooledEventDispatcher, ThreadPooledEventDispatcherMBean
public class SimpleEventDispatcher
- extends AbstractThreadPooledEventDispatcher
- implements ThreadPooledEventDispatcher, SimpleEventDispatcherMBean
A thread-pooled EventDispatcher
that 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 OrderedEventDispatcher
instead.
Set thread pool size (AbstractThreadPooledEventDispatcher.setThreadPoolSize(int)
) and call
AbstractThreadPooledEventDispatcher.start()
to activate this event dispatcher.
Please note that dispatcher threads will not terminate even if
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.
- Version:
- $Rev: 4 $, $Date: 2005-04-18 12:04:09 +0900 $
- Author:
- Trustin Lee (http://gleamynode.net/dev/)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleEventDispatcher
public SimpleEventDispatcher()
- Creates a new instance.
getWaitingEventSize
public int getWaitingEventSize()
- Description copied from interface:
EventDispatcher
- Returns the number of session events that are still not dispatched to
SessionListener
s.
- Specified by:
getWaitingEventSize
in interface EventDispatcher
- Specified by:
getWaitingEventSize
in interface EventDispatcherMBean
- See Also:
EventDispatcher.getWaitingEventSize()
newWorker
protected AbstractThreadPooledEventDispatcher.AbstractWorker newWorker()
- Specified by:
newWorker
in class AbstractThreadPooledEventDispatcher
removeWorker
protected AbstractThreadPooledEventDispatcher.AbstractWorker removeWorker()
- Specified by:
removeWorker
in class AbstractThreadPooledEventDispatcher
fire
public void fire(Event event)
- Description copied from interface:
EventDispatcher
- Fires the specified session event.
- Specified by:
fire
in interface EventDispatcher
Copyright © 2004-2008 Trustin Lee. All Rights Reserved.