| schedule(TimerTask task, long delay) Schedules the specified task for execution after the specified delay. |
| schedule(TimerTask task, long delay, long period) Schedules the specified task for repeated fixed-delay execution, beginning after the specified delay. |
(1)schedule方法: 下一次执行时间相对于上一次实际执行完成的时间点,因此执行时间会不断延后。
(2)scheduleAtFixedRate方法:下一次执行时间相对于上一次执行开始的时间点,因此执行时间不会延后,存在并发性。可能发生在短时间内多次调用Task的情况,因为很多次都被延迟了,只能一起启动。