【问题标题】:How to disable Quartz update attempt?如何禁用 Quartz 更新尝试?
【发布时间】:2013-01-03 21:28:38
【问题描述】:

我正在使用:

    <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz</artifactId>
        <version>1.8.0</version>
    </dependency>

当应用程序出现时,我总是得到:

2013-01-03 15:25:34 UpdateChecker [DEBUG] Checking for available updated 
                        version of Quartz...
2013-01-03 15:25:43 UpdateChecker [DEBUG] Quartz version update check failed:
                        java.io.IOException: Server returned HTTP response 
                        code: 503 for URL: long url here

如何消除这些? (消息和尝试更新)

【问题讨论】:

标签: java quartz-scheduler


【解决方案1】:

quartz.properties,可以添加

org.quartz.scheduler.skipUpdateCheck=true

在代码中,这看起来像:

Properties props = new Properties();
props.setProperty("org.quartz.scheduler.skipUpdateCheck","true");

// set other properties ...such as
props.setProperty("org.quartz.jobStore.class", "org.quartz.simpl.RAMJobStore");
props.setProperty("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
props.setProperty("org.quartz.threadPool.threadCount", "4");

SchedulerFactory schdFact = new StdSchedulerFactory(props);

编辑:

从下面@Stephan202 的评论中,您可以使用常量PROP_SCHED_SKIP_UPDATE_CHECK

这种情况下的代码是

props.setProperty(StdSchedulerFactory.PROP_SCHED_SKIP_UPDATE_CHECK,"true");

【讨论】:

  • 我在这里给了你一个 all-code 的例子。您可以从现有的 quartz.properties 加载属性并添加到它们。
  • 对应的常量是StdSchedulerFactory.PROP_SCHED_SKIP_UPDATE_CHECK
  • 如果使用 Spring 框架和 SchedulerFactoryBean 并且您没有(或不想要)quartz.properties 文件,请参阅此问题/答案以了解如何在 bean config 中设置 Quartz 属性:stackoverflow.com/questions/8403384/…
  • 我不知道为什么,但是默认使用 quartz.properties 对我不起作用,而我自己加载它并作为属性传递确实有效。
猜你喜欢
  • 1970-01-01
  • 2019-07-04
  • 1970-01-01
  • 2011-05-24
  • 1970-01-01
  • 2015-07-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多