public class TaskScheduler
extends java.lang.Thread
All tasks will executed in a Runnable with
SwingUtilities.invokeLater
. So tasks are Swing thread
safty.
You can create new TaskScheduler instance, but most of the cases you can just use the default instance which can be accessed by method #getInstance. The minimum interval value of the default instance is 500 millisecond.
Task}
,
TaskAdapter}
Modifier and Type | Method and Description |
---|---|
static TaskScheduler |
createTaskScheduler(int minInterval)
Creates a new TaskScheduler instance with a specified min interval.
|
static TaskScheduler |
getInstance()
Gets default TaskScheduler instance
|
int |
getMinInterval()
Get the minimum interval of this task scheduler in millisecond.
|
boolean |
isRunning()
Checks whether this task scheduler is running.
|
boolean |
register(Task task)
Register a task into this task scheduler.
|
void |
run() |
void |
setMinInterval(int minInterval)
Set the minimum interval of this task scheduler in millisecond.
|
void |
start(java.lang.String threadName) |
void |
stopTaskScheduler() |
boolean |
unregister(Task task)
Unregister a task from the task scheduler.
|
activeCount, checkAccess, clone, 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
public void start(java.lang.String threadName)
public void stopTaskScheduler()
public static TaskScheduler getInstance()
public static TaskScheduler createTaskScheduler(int minInterval)
minInterval
- minimum internalpublic boolean register(Task task)
task
- task need to registeredunregister(twaver.Task)
public boolean unregister(Task task)
task
- the task need to removeregister(twaver.Task)
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public int getMinInterval()
setMinInterval(int)
public void setMinInterval(int minInterval)
minInterval
- int the minimum interval of this task scheduler in millisecond.getMinInterval()
public boolean isRunning()
Copyright © 2002 - 2010 Serva Software. All Rights Reserved.