Timer timer = new Timer();
// scheduling the task at interval
timer.schedule(tasknew,100, 100);
如果在启动时将其添加为 Web 应用程序的一部分,则任务如何在预定时间启动?是否正在创建一个新的守护线程进程,专门用于触发此任务?
我只是想了解我们是否正在创建负责此任务线程的任何附加线程?
最佳答案
I just wanted to understand if we are creating any additional threads that is responsible for this task threads?
是 - 来自 documentation :
Corresponding to each Timer object is a single background thread that is used to execute all of the timer's tasks, sequentially.
关于Java util Timer - 线程添加,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27278638/