- All Implemented Interfaces:
- java.lang.Runnable
public class Scheduler
extends java.lang.Object
implements java.lang.Runnable
Implementation of a priority scheduler. The scheduler maintains a queue to the end of which
all tasks are added. It continually looks at the first queue element, assigns a thread to
it, runs the thread and waits for completion. When a new priority task is added,
it will be added to the head of the queue and the scheduler will be interrupted. In this
case, the currently handled task is suspended, and the one at the head of the queue
handled. This is recursive: a priority task can always be interrupted by another priority
task. Resursion ends when no more priority tasks are added, or when the thread pool is
exhausted.
- Author:
- Bela Ban