標籤:定時器 quartz unix
- 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只需考慮線程之間如何調度的問題
cron is platform dependent, Quartz is not. cron是依賴於unix平台的,而Quartz使跨平台的
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不會
Quartz has a more flexible language of expressing occurences (when the tasks should be fired).Quarz支援更豐富的執行命令
- 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 每個任務都是一個單獨的進程
- 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).
- 補充,Quartz支援秒層級的任務,而 cron支援分鐘層級的;Quratz有可視化的任務管理介面,監控、營運更方面,健壯性更強
- 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