Quaqua 5.4.1 2009-07-14

ch.randelshofer.quaqua.util
Class SequentialDispatcher

java.lang.Object
  extended by ch.randelshofer.quaqua.util.EventLoop
      extended by ch.randelshofer.quaqua.util.SequentialDispatcher

public class SequentialDispatcher
extends EventLoop

Processes Runnable objects sequentially on a processor thread. The order in which the runnable objects are processed is the same in which they were added to the dispatcher.

Design pattern used: Acceptor Role in design pattern: EventCollector and EventProcessor

Version:
1.0 2002-05-18 Created
Author:
Werner Randelshofef

Constructor Summary
SequentialDispatcher()
          Creates new SequentialDispatcher which processes Runnable objects at java.lang.Thread.NORM_PRIORITY.
SequentialDispatcher(int priority)
          Creates a new SequentialDispatcher which processes Runnable Objects at the desired thread priority.
 
Method Summary
 void dispatch(java.lang.Runnable r)
          Queues the Runnable object for later execution on the processor thread.
protected  void processEvent(java.lang.Object event)
          This method processes an event on the event processor thread.
 
Methods inherited from class ch.randelshofer.quaqua.util.EventLoop
clear, collectEvent, dispose, isCoalesce, isLIFO, processEvents, setCoalesce, setLIFO, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SequentialDispatcher

public SequentialDispatcher()
Creates new SequentialDispatcher which processes Runnable objects at java.lang.Thread.NORM_PRIORITY.


SequentialDispatcher

public SequentialDispatcher(int priority)
Creates a new SequentialDispatcher which processes Runnable Objects at the desired thread priority.

Parameters:
priority - The Thread priority of the event processor.
Method Detail

processEvent

protected void processEvent(java.lang.Object event)
This method processes an event on the event processor thread.

Specified by:
processEvent in class EventLoop
Parameters:
event - An event from the queue.

dispatch

public void dispatch(java.lang.Runnable r)
Queues the Runnable object for later execution on the processor thread.


Copyright 2003-2007 (c) Werner Randelshofer.
All rights reserved.