All Packages Class Hierarchy This Package Previous Next Index
Class magician.Node.Scheduler
java.lang.Object
|
+----magician.Node.Scheduler
- public class Scheduler
- extends Object
- implements PerfConstants
Class Scheduler ensures that only a fixed number of threads are
running at a certain interval. If the maximum number of threads is
reached, the new thread is put in the queue and is scheduled to run
when possible.
The priority of a thread is lowered periodically to give a new thread
a chance to run.
-
EventMgr
- Event manager to log events
-
maxThreads
- maximum number of SmartPacket threads that can run concurrently
-
QTime
- table to maintain queueng times
-
readyQueue
- the queue of ready Smartpacket threads
-
runningThreads
- list of running SmartPacket threads
-
ticker
- the clock thread
-
Scheduler(int)
- initializes the scheduler with the maximum number of runnable threads
-
invoke()
- invokes the Schduler to remove the calling Smartpacket thread
-
Schedule(SPThread)
- Schedules the Smartpacket thread for execution
-
tick()
- checks on active threads and performs thread maintenance
maxThreads
protected int maxThreads
- maximum number of SmartPacket threads that can run concurrently
readyQueue
protected SchedQueue readyQueue
- the queue of ready Smartpacket threads
runningThreads
protected UnsynchVector runningThreads
- list of running SmartPacket threads
EventMgr
EventManager EventMgr
- Event manager to log events
QTime
protected Hashtable QTime
- table to maintain queueng times
ticker
static Thread ticker
- the clock thread
Scheduler
public Scheduler(int maxThreads)
- initializes the scheduler with the maximum number of runnable threads
- Parameters:
- maxThreads - number of threads
tick
public void tick()
- checks on active threads and performs thread maintenance
invoke
protected static void invoke()
- invokes the Schduler to remove the calling Smartpacket thread
Schedule
public void Schedule(SPThread t)
- Schedules the Smartpacket thread for execution
- Parameters:
- t - the Smartpacket thread
All Packages Class Hierarchy This Package Previous Next Index