javax.management.timer
Class Scheduler
java.lang.Object
|
+--java.lang.Thread
|
+--javax.management.timer.Scheduler
- public class Scheduler
- extends java.lang.Thread
A scheduler for running tasks in a Java VM.
This class can be used to schedule a particular task at a
specified time. This is basically to control effectively a number of tasks
using a limited number of threads
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY,
MIN_PRIORITY,
NORM_PRIORITY,
values |
| Methods inherited from class java.lang.Thread |
,
activeCount,
checkAccess,
countStackFrames,
currentThread,
destroy,
dumpStack,
enumerate,
getContextClassLoader,
getName,
getPriority,
getThreadGroup,
interrupt,
interrupted,
isAlive,
isDaemon,
isInterrupted,
join,
join,
join,
resume,
setContextClassLoader,
setDaemon,
setName,
setPriority,
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 |
MAX_THREADS
int MAX_THREADS
- The maximum numer of threads to be used in executing tasks for this
scheduler
TOTAL_THREADS
static int TOTAL_THREADS
STOP_ALL
static boolean STOP_ALL
STOP_THIS
boolean STOP_THIS
NUM_THREADS_STOPPED
int NUM_THREADS_STOPPED
runnables
java.util.Vector runnables
times
java.util.Vector times
workers
java.util.Vector workers
ready_tasks
java.util.Vector ready_tasks
STOP_TIME_OUT
static int STOP_TIME_OUT
getMaxThreads
public int getMaxThreads()
getDefaultMaxThreads
public static int getDefaultMaxThreads()
setDefaultMaxThreads
public static void setDefaultMaxThreads(int i)
setMaxThreads
public boolean setMaxThreads(int i)
getTotalThreads
public static int getTotalThreads()
getConfFile
public static java.lang.String getConfFile()
setConfFile
public static void setConfFile(java.lang.String s)
createScheduler
public static Scheduler createScheduler(java.lang.String nam)
createScheduler
public static Scheduler createScheduler(java.lang.String nam,
int maxThreadNumber)
getScheduler
public static Scheduler getScheduler(java.lang.String nam)
scheduleTask
public void scheduleTask(java.lang.Runnable task,
java.util.Date when)
- This methood schedules a one-time task at the specified time
removeTask
public void removeTask(java.lang.Runnable task)
- This methood is used to remove a task from being scheduled.
resumeAll
public boolean resumeAll()
killScheduler
public void killScheduler()
stopAll
public static boolean stopAll()
stopThis
public boolean stopThis()
cleanUp
public boolean cleanUp()
setStopTimeout
public void setStopTimeout(int timeout)
getTheWork
java.lang.Runnable getTheWork()
- something to let this thread rest when nothing to do
run
public void run()
- The main thread which kicks off the task execution
- Overrides:
- run in class java.lang.Thread
waitSchedule
void waitSchedule()
throws java.lang.InterruptedException
startTask
void startTask(java.lang.Runnable task)
- start the task
getNextTask
java.lang.Runnable getNextTask()
- get the next task ready to run
startWorkers
void startWorkers()
- start the workers
deregisterThisScheduler
public void deregisterThisScheduler(java.lang.String nam)