i3.dragos.core
Class TaskScheduler

java.lang.Object
  extended by java.lang.Thread
      extended by i3.dragos.core.TaskScheduler
All Implemented Interfaces:
KernelModule, java.lang.Runnable

public final class TaskScheduler
extends java.lang.Thread
implements KernelModule

The TaskScheduler executes all registered tasks on a regular basis.

Author:
Boris Boehlen <boehlen@cs.rwth-aachen.de>

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TaskScheduler()
          Consttructs the task scheduler.
 
Method Summary
 void addTask(Task task)
          Adds the specified task to the scheduler.
static TaskScheduler getInstance()
          Returns the task scheduler registered to the module manager.
 java.lang.String getRole()
          Returns the kernel module's role.
 void initialize()
          Initializes the kernel module.
 void removeTask(Task task)
          Removes the specified task from the scheduler.
 void run()
          Schedules the execution of the tasks.
 void uninitialize()
          Uninitializes the kernel module and releases all resources used by it.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TaskScheduler

public TaskScheduler()
Consttructs the task scheduler.

Method Detail

getInstance

public static TaskScheduler getInstance()
Returns the task scheduler registered to the module manager.

Returns:
the task scheduler registered to the module manager.

getRole

public java.lang.String getRole()
Returns the kernel module's role.

Specified by:
getRole in interface KernelModule
Returns:
the kernel module's role.

initialize

public void initialize()
Initializes the kernel module.

Specified by:
initialize in interface KernelModule

uninitialize

public void uninitialize()
Uninitializes the kernel module and releases all resources used by it.

Specified by:
uninitialize in interface KernelModule

run

public void run()
Schedules the execution of the tasks.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

addTask

public void addTask(Task task)
Adds the specified task to the scheduler. If the tasks is already managed by the scheduler only its execution interval is modified.

Parameters:
task - The task that is added.

removeTask

public void removeTask(Task task)
Removes the specified task from the scheduler.

Parameters:
task - The task that is removed.


Copyright © 2002-2008 RWTH Aachen, Department of Computer Science 3 (Software Engineering). All Rights Reserved.