search

Home  >  Q&A  >  body text

java - timer.schedule方法必须等上一个任务执行完毕才能进行下一个任务吗?

timer.schedule方法必须等上一个任务执行完毕才能进行下一个任务吗?还是说如果上一个任务还没有执行结束,下一个任务也会启动。
如果任务在执行过程中发生异常,是不是会结束本次任务的执行。等下一次执行时间一到它还能执行任务吗?

高洛峰高洛峰2889 days ago1256

reply all(2)I'll reply

  • PHPz

    PHPz2017-04-18 09:15:33

    Different timer instances schedule different tasks without affecting each other, and different tasks can be executed at the same time. The same timer instance schedules multiple tasks, and only one task is executed at the same time. You can write a small demo to verify it yourself.

    reply
    0
  • ringa_lee

    ringa_lee2017-04-18 09:15:33

    I believe you will have no doubts after reading this article: http://www.cnblogs.com/chenssy/p/3788407.html

    reply
    0
  • Cancelreply