使用java.util.timer与Quartz进行调度的优缺点? [英] Pros and cons of using java.util.timer vs Quartz for scheduling?

查看:874
本文介绍了使用java.util.timer与Quartz进行调度的优缺点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须编写一个执行一系列任务的应用程序:

I've got to write an app that performs a series of tasks:


  1. 每天0200时运行一次任务。

  2. 任务将于0400时运行一次

  3. 任务以间隔15分钟从0003小时开始运行

  4. 任务以每隔15分钟的间隔运行,从0005小时开始

  1. task to be run once at 0200 hours every day.
  2. task to be run once at 0400 hours ever day
  3. task to be run at 15 minute intervals starting at 0003 hours
  4. task to be run at 15 minute intervals starting at 0005 hours

使用普通java的优点和缺点是什么.util.timer比Quartz for this?

What are the pros and cons of using plain java.util.timer Vs. Quartz for this?

还有其他我应该考虑的选择吗?

Are there any other alternatives I should be considering?

推荐答案

Quartz




  • 附加依赖

  • API目前(2011年末)更改:1。 x在出路的时候,但是唯一一个得到Spring和其他人支持的人

  • 可以永久存储作业;可以对多个调度程序进行集群以实现负载平衡和故障转移

  • Job和Trigger之间的区别需要一些时间来适应 - 但是可以

  • 更强大的重复调度表达式(例如CronTrigger for cron表达式)

  • Quartz

    • Additional dependency
    • API currently (late 2011) changing: 1.x on its way out, but the only one supported by Spring and possibly others
    • Jobs can be stored persistently; multiple Schedulers can be clustered for load balancing and failover
    • The differentiation between Job and Trigger takes a bit getting used to - but it is possible to
    • More powerful repeated scheduling expressions (e.g. CronTrigger for cron expressions)

      • 开箱即用JSE 1.3+

      • 为您的功能提供足够的功能

      • 不太灵活,但不太复杂以及

      我个人使用Quartz +持久存储用于Web应用程序,其中触发器可以交互式创建,并且应该在重新启动后使用< a href =http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/scheduling.html =noreferrer> Spring的调度抽象。两种API恕我直言都缺乏一个重要的概念:在一段时间后重试失败的任务。为自己添加这个是一个痛苦的重复任务,也应该重试。

      I am personally using Quartz + persistent storage for a Web application where triggers can be created interactively and should survive restarts, using Spring's scheduling abstraction. Both APIs IMHO lack an important concept: retrying failed tasks after a certain period of time. Adding this for myself was a pain for repeated tasks that should be retried as well.

      这篇关于使用java.util.timer与Quartz进行调度的优缺点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆