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
-
Field Summary
Fields inherited from class org.monte.media.concurrent.EventLoop
eventProcessor -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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
Modifier and TypeMethodDescriptionvoidQueues the Runnable object for later execution on the processor thread.protected voidprocessEvent(Runnable event) This method processes an event on the event processor thread.Methods inherited from class org.monte.media.concurrent.EventLoop
clear, collectEvent, isCoalesce, join, processEvents, setCoalesce, start, stop
-
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
This method processes an event on the event processor thread.- Specified by:
processEventin classEventLoop<Runnable>- Parameters:
event- An event from the queue.
-
dispatch
Queues the Runnable object for later execution on the processor thread.
-