timer,TimerTask的使用
2008-08-28 11:18
337 查看
timer,TimerTask结合使用来完成定时任务,需要注意的是只要一个timer任务被意外中止,则整个任务被中止。可以采用线程代替这种应用。
public class timerapp
extends TimerTask
{
timerapp(){
}
public void run(){
}
}
Timer sss = new Timer();
sss.schedule(new timerapp,100,10000);
syntax:
void schedule(TimerTask task, long delay, long period)
Schedules the specified task for repeated fixed-delay execution, beginning after the specified delay.
public class timerapp
extends TimerTask
{
timerapp(){
}
public void run(){
}
}
Timer sss = new Timer();
sss.schedule(new timerapp,100,10000);
syntax:
void schedule(TimerTask task, long delay, long period)
Schedules the specified task for repeated fixed-delay execution, beginning after the specified delay.
相关文章推荐
- android使用timer和timertask实现计时器
- 定时任务:Java中Timer和TimerTask的使用
- java类Timer和TimerTask的使用
- 使用Java中的Timer和TimerTask
- 定时任务:Java中Timer和TimerTask的使用
- 定时任务:Java中Timer和TimerTask的使用
- Timer 和TimerTask 使用
- Timer和TimerTask的使用
- 定时任务:Java中Timer和TimerTask的使用
- Java中的Timer和TimerTask的使用
- java中Timer和timertask使用例程
- 定时任务:Java中Timer和TimerTask的使用
- java类Timer和TimerTask的使用
- 使用ScheduledThreadPoolExecutor代替Timer&TimerTask
- 定时任务:Java中Timer和TimerTask的使用
- 定时任务:Java中Timer和TimerTask的使用
- Timer和TimerTask的使用
- Timer和TimerTask的使用--2
- Java中使用Timer和TimerTask实现多线程
- 使用Java中的Timer和TimerTask