public interface Task
SwingUtilities.invokeLater
. So the task is Swing
safty, you can access all Swing resources in this task
without considering the Swing thread and repaint related issues.
Before TaskScheduler invoke 'run' method to execute task, method interested will be called first to determine whether the run should be called in this cycle. If method interested return false, TaskScheduler will ignore this task in this cycle.
Please do not use SwingUtilities.invokeAndWait in run method body. It will cause dead lock.
Normally using class TaskAdapter
to create
a task is more easier.
TaskScheduler}
,
TaskAdapter}
Modifier and Type | Method and Description |
---|---|
int |
getInterval()
Return the interval of the task should be repeated in MSEL.
|
boolean |
interested()
Task scheduler will call this method to check
whether should invoke run method body.
|
void |
run(long clock)
This method defines the task executed body.
|
void |
setInterval(int interval)
Set the new task interval in milliseconds.
|
void run(long clock)
clock
- long This value is not used currently.int getInterval()
setInterval}
void setInterval(int interval)
interval
- the new task interval in millisecondsgetInterval}
boolean interested()
Please note that return false just pause the task but the task is still under the control by task scheduler. If you want remove the task from system, remove it from task scheduler.
TaskScheduler.unregister}
Copyright © 2002 - 2010 Serva Software. All Rights Reserved.