net.gleamynode.netty2
Class LowLatencyEventDispatcher

java.lang.Object
  extended by net.gleamynode.netty2.LowLatencyEventDispatcher
All Implemented Interfaces:
EventDispatcher, EventDispatcherMBean, LowLatencyEventDispatcherMBean

public class LowLatencyEventDispatcher
extends Object
implements EventDispatcher, LowLatencyEventDispatcherMBean

An EventDispatcherthat provides low latency. This event dispatcher uses the same thread with IoProcessor. So I/O operation will get slow as SessionListenerprocesses events slowly, and you'll have to adjust I/O thread pool size using IoProcessor.setThreadPoolSize(int). There is no need to invoke any initialization/deinitialization methods.

Please note that I/O threads will not terminate even if IoProcessor.stop()is invoked if there are any remaining events for process to 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/)

Constructor Summary
LowLatencyEventDispatcher()
          Creates a new low latency event dispatcher.
 
Method Summary
 void fire(Event event)
          Fires the specified session event.
 void flush()
          (Optional operation) Flushes the buffered events.
 int getWaitingEventSize()
          Returns 0 because this thread is not multi-threaded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LowLatencyEventDispatcher

public LowLatencyEventDispatcher()
Creates a new low latency event dispatcher.

Method Detail

getWaitingEventSize

public int getWaitingEventSize()
Returns 0 because this thread is not multi-threaded.

Specified by:
getWaitingEventSize in interface EventDispatcher
Specified by:
getWaitingEventSize in interface EventDispatcherMBean
See Also:
EventDispatcher.getWaitingEventSize()

fire

public void fire(Event event)
Description copied from interface: EventDispatcher
Fires the specified session event.

Specified by:
fire in interface EventDispatcher

flush

public void flush()
Description copied from interface: EventDispatcher
(Optional operation) Flushes the buffered events. This method is invoked by ReadController#processEvent(Event)and WriteController#processEvent(Event)after the expected I/O operations have been completed. So you can implement EventDispatcherto buffer the fireXXX calls and fire (flush) them here in actually.

Specified by:
flush in interface EventDispatcher


Copyright © 2004-2010 Trustin Lee. All Rights Reserved.