首页 > 代码库 > 定时器UNIX crontab vs Quartz

定时器UNIX crontab vs Quartz

  1. Using cron seems to add another entry point into your application, while Quartz would integrate into it. So you would be forced to deal with some inter-process communication if you wanted to pass some information to/from the process invoked from cron. In Quartz you simply (hehe) run multiple threads. cron是进程级别,Quartz是线程级别;如果任务之间有依赖、通信关系,那么cron将是一个大难题,而Quartz只需考虑线程之间如何调度的问题
  2. cron is platform dependent, Quartz is not. cron是依赖于unix平台的,而Quartz使跨平台的
  3. Quartz may allow you to reliably make sure a task is run at the given time or some time after if the server was down for some time. Pure cron wouldn‘t do it for you (unless you handle it manually).Quartz会保证即使服务重启,任务仍然会在指定的时间重新执行,而cron不会
  4. Quartz has a more flexible language of expressing occurences (when the tasks should be fired).Quarz支持更丰富的执行命令
  5. Consider the memory footprint. If your single tasks share nothing or little, then it might be better to run them from the operating system as a separate process. If they share a lot of information, it‘s better to have them as threads within one process.Quartz占用更少的内存,单进程内执行多任务,而 cron 每个任务都是一个单独的进程
  6. Not quite sure how you could handle the clustering in the cron approach. Quartz might be used with Terracotta following the scaling out pattern (I haven‘t tried it, but I believe it‘s doable).
  7. 补充,Quartz支持秒级别的任务,而 cron支持分钟级别的;Quratz有可视化的任务管理界面,监控、运维更方面,健壮性更强
  8. Quartz支持集群

原文:http://stackoverflow.com/questions/1029383/time-triggered-job-cron-or-quartz
参考:http://www.coderanch.com/t/63580/open-source/cron-Quartz

定时器UNIX crontab vs Quartz