cron4j 是一个Java的任务调度框架,类似于UNIX系统下的crontab.
使用示例:
import it.sauronsoftware.cron4j.Scheduler; public class TestScheduler { public static void main(String[] args) throws Throwable { Scheduler scheduler = new Scheduler(); scheduler.schedule("* * * * *", new HelloWorldTask()); scheduler.start(); Thread.sleep(300000); // pause the main thread for 5 minutes scheduler.stop(); } }