在我的类中设置了3个Timer定时器(Timer1,Timer3,Timer10),3个定时器分别设置执行的时间是1分钟,3分钟,10分钟,在这3个定时器的TimerTask里面都执行一个synchronized的同步函数操作。
现发现执行一段时间之后3分钟的定时器的线程会死掉,程序不再执行Timer3的TimerTask,请问有什么方法可以监控定时器的线程状态,然后重新启动该线程呢???
现发现执行一段时间之后3分钟的定时器的线程会死掉,程序不再执行Timer3的TimerTask,请问有什么方法可以监控定时器的线程状态,然后重新启动该线程呢???
Corresponding to each Timer object is a single background thread that is used to execute all of the timer's tasks, sequentially. Timer tasks should complete quickly. If a timer task takes excessive time to complete, it "hogs" the timer's task execution thread.