Class SequentialDispatcher

java.lang.Object
org.monte.media.concurrent.EventLoop<Runnable>
org.monte.media.concurrent.SequentialDispatcher

public class SequentialDispatcher extends EventLoop<Runnable>
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

Author:
Werner Randelshofef
  • Constructor Details

    • 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 Details

    • processEvent

      protected void processEvent(Runnable event)
      This method processes an event on the event processor thread.
      Specified by:
      processEvent in class EventLoop<Runnable>
      Parameters:
      event - An event from the queue.
    • dispatch

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