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.


Inner Class Summary
 class Scheduler.Task
           
 
Constructor Summary
Scheduler()
           
Scheduler(int num_threads)
           
 
Method Summary
 void Add(java.lang.Runnable task)
           
 void AddPrio(java.lang.Runnable task)
           
static void main(java.lang.String[] args)
           
 void Reset()
           
 void run()
           
 void SetListener(SchedulerListener l)
           
 void Start()
           
 void Stop()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scheduler

public Scheduler()

Scheduler

public Scheduler(int num_threads)
Method Detail

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)