JavaGroups
Class Scheduler
java.lang.Object
|
+--JavaGroups.Scheduler
- 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.
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Scheduler
public Scheduler()
Scheduler
public Scheduler(int num_threads)
SetListener
public void SetListener(SchedulerListener l)
run
public void run()
- Specified by:
- run in interface java.lang.Runnable
AddPrio
public void AddPrio(java.lang.Runnable task)
Add
public void Add(java.lang.Runnable task)
Reset
public void Reset()
Start
public void Start()
Stop
public void Stop()
main
public static void main(java.lang.String[] args)