`

quartz Configuration

阅读更多

Quartz Enterprise Job Scheduler Configuration Reference

Configure Main Scheduler Settings

 

 

 

These properties configure the identification of the scheduler, and various other 'top level' settings.

Property Name Required Type Default Value
org.quartz.scheduler.instanceName no string 'QuartzScheduler'
org.quartz.scheduler.instanceId no string 'NON_CLUSTERED'
org.quartz.scheduler.instanceIdGenerator.class no string (class name) org.quartz.simpl.SimpleInstanceIdGenerator
org.quartz.scheduler.threadName no string instanceName + '_QuartzSchedulerThread'
org.quartz.scheduler.makeSchedulerThreadDaemon no boolean false
org.quartz.scheduler.threadsInheritContextClassLoaderOfInitializer no boolean false
org.quartz.scheduler.idleWaitTime no long 30000
org.quartz.scheduler.dbFailureRetryInterval no long 15000
org.quartz.scheduler.classLoadHelper.class no string (class name) org.quartz.simpl.CascadingClassLoadHelper
org.quartz.scheduler.jobFactory.class no string (class name) org.quartz.simpl.SimpleJobFactory
org.quartz.context.key.SOME_KEY no string none
org.quartz.scheduler.userTransactionURL no string (url) 'java:comp/UserTransaction'
org.quartz.scheduler.wrapJobExecutionInUserTransaction no boolean false
org.quartz.scheduler.skipUpdateCheck no boolean false

org.quartz.scheduler.instanceName 
Can be any string, and the value has no meaning to the scheduler itself - but rather serves as a mechanism for client code to distinguish schedulers when multiple instances are used within the same program. If you are using the clustering features, you must use the same name for every instance in the cluster that is 'logically' the same Scheduler.

org.quartz.scheduler.instanceId 
Can be any string, but must be unique for all schedulers working as if they are the same 'logical' Scheduler within a cluster. You may use the value "AUTO" as the instanceId if you wish the Id to be generated for you.

org.quartz.scheduler.instanceIdGenerator.class 
Only used if org.quartz.scheduler.instanceId is set to "AUTO". Defaults to "org.quartz.simpl.SimpleInstanceIdGenerator", which generates an instance id based upon host name and time stamp.

org.quartz.scheduler.threadName 
Can be any String that is a valid name for a java thread. If this property is not specified, the thread will receive the scheduler's name ("org.quartz.scheduler.instanceName") plus an the appended string '_QuartzSchedulerThread'.

org.quartz.scheduler.makeSchedulerThreadDaemon
A boolean value ('true' or 'false') that specifies whether the main thread of the scheduler should be a daemon thread or not. See also theorg.quartz.scheduler.makeSchedulerThreadDaemon property for tuning the SimpleThreadPool if that is the thread pool implementation you are using (which is most likely the case).

org.quartz.scheduler.threadsInheritContextClassLoaderOfInitializer
A boolean value ('true' or 'false') that specifies whether the threads spawned by Quartz will inherit the context ClassLoader of the initializing thread (thread that initializes the Quartz instance). This will affect Quartz main scheduling thread, JDBCJobStore's misfire handling thread (if JDBCJobStore is used), cluster recovery thread (if clustering is used), and threads in SimpleThreadPool (if SimpleThreadPool is used). Setting this value to 'true' may help with class loading, JNDI look-ups, and other issues related to using Quartz within an application server.

org.quartz.scheduler.idleWaitTime 
Is the amount of time in milliseconds that the scheduler will wait before re-queries for available triggers when the scheduler is otherwise idle. Normally you should not have to 'tune' this parameter, unless you're using XA transactions, and are having problems with delayed firings of triggers that should fire immediately.

org.quartz.scheduler.dbFailureRetryInterval 
Is the amount of time in milliseconds that the scheduler will wait between re-tries when it has detected a loss of connectivity within the JobStore (e.g. to the database). This parameter is obviously not very meaningful when using RamJobStore.

org.quartz.scheduler.classLoadHelper.class 
Defaults to the most robust approach, which is to use the "org.quartz.simpl.CascadingClassLoadHelper" class - which in turn uses every other ClassLoadHelper class until one works. You should probably not find the need to specify any other class for this property, though strange things seem to happen within application servers. All of the current possible ClassLoadHelper implementation can be found in the org.quartz.simpl package.

org.quartz.scheduler.jobFactory.class
The class name of the JobFactory to use. The default is 'org.quartz.simpl.SimpleJobFactory', you may like to try 'org.quartz.simpl.PropertySettingJobFactory'. A JobFatcory is responsible for producing instances of JobClasses. SimpleJobFactory simply calls newInstance() on the class. PropertySettingJobFactory does as well, but also reflectively sets the job's bean properties using the contents of the JobDataMap.

org.quartz.context.key.SOME_KEY 
Represent a name-value pair that will be placed into the "scheduler context" as strings. (see Scheduler.getContext()). So for example, the setting "org.quartz.context.key.MyKey = MyValue" would perform the equivalent of scheduler.getContext().put("MyKey", "MyValue").

InfoThe Transaction-Related properties should be left out of the config file unless you are using JTA transactions.

org.quartz.scheduler.userTransactionURL 
Should be set to the JNDI URL at which Quartz can locate the Application Server's UserTransaction manager. The default value (if not specified) is "java:comp/UserTransaction" - which works for almost all Application Servers. Websphere users may need to set this property to "jta/usertransaction". This is only used if Quartz is configured to use JobStoreCMT, and org.quartz.scheduler.wrapJobExecutionInUserTransaction is set to true.

org.quartz.scheduler.wrapJobExecutionInUserTransaction 
Should be set to "true" if you want Quartz to start a UserTransaction before calling execute on your job. The Tx will commit after the job's execute method completes, and after the JobDataMap is updated (if it is a StatefulJob). The default value is "false".

org.quartz.scheduler.skipUpdateCheck 
Whether or not to skip running a quick web request to determine if there is an updated version of Quartz available for download. If the check runs, and an update is found, it will be reported as available in Quartz's logs.

 

 

 

 

Configure ThreadPool Settings

Property Name Required Type Default Value
org.quartz.threadPool.class yes string (clas name) null
org.quartz.threadPool.threadCount yes int -1
org.quartz.threadPool.threadPriority no int Thread.NORM_PRIORITY (5)

org.quartz.threadPool.class 
Is the name of the ThreadPool implementation you wish to use. The threadpool that ships with Quartz is "org.quartz.simpl.SimpleThreadPool", and should meet the needs of nearly every user. It has very simple behavior and is very well tested. It provides a fixed-size pool of threads that 'live' the lifetime of the Scheduler.

org.quartz.threadPool.threadCount 
Can be any positive integer, although you should realize that only numbers between 1 and 100 are very practical. This is the number of threads that are available for concurrent execution of jobs. If you only have a few jobs that fire a few times a day, then 1 thread is plenty! If you have tens of thousands of jobs, with many firing every minute, then you probably want a thread count more like 50 or 100 (this highly depends on the nature of the work that your jobs perform, and your systems resources!).

org.quartz.threadPool.threadPriority 
Can be any int between Thread.MIN_PRIORITY (which is 1) and Thread.MAX_PRIORITY (which is 10). The default is Thread.NORM_PRIORITY (5).




 

 

分享到:
评论

相关推荐

    简单实现Spring Quartz定时器

    至于工具,像`qconf`(Quartz Configuration and Management Tool)这样的图形化工具可以帮助我们更直观地管理和监控Quartz调度器。此外,IDE插件如Eclipse的Quartz plugin也提供了方便的集成开发环境支持。 总的来...

    springboot 集成quartz

    亲测可用,springboot整合quartz。包含2个核心类QuartzConfiguration类和JobFactory类,修改数据库连接application和quartz.properties直接运行,访问http://localhost:8080/index。

    quartz界面化持久化管理

    - 可以通过Spring的`@Configuration`和`@Bean`注解,将Quartz集成到Spring应用上下文中,简化配置和管理。 9. **日志和监控**: - 配置合适的日志框架(如Log4j或Logback)记录任务执行情况,便于故障排查。 - ...

    Quartz_Scheduler_Configuration_Guide.pdf Version2.2.1

    《Quartz Scheduler Configuration Guide》版本2.2.1是一份详细介绍了如何配置Quartz Scheduler的重要文档。该文档适用于Quartz Scheduler 2.2.1及后续所有版本。其中涵盖了关于Quartz配置的所有关键方面,包括主...

    Quartz2.2.1基于Spring注解方式配置Quartz

    @Configuration @EnableScheduling public class QuartzConfig { @Bean public SchedulerFactoryBean schedulerFactoryBean() { SchedulerFactoryBean factory = new SchedulerFactoryBean(); factory....

    SpringBoot 整合Quartz(集群)实现定时任务调度

    @Configuration public class QuartzConfig { @Autowired private SchedulerFactoryBean schedulerFactoryBean; @Bean public JobDetail myTaskJobDetail() { return JobBuilder.newJob(MyTask.class) ....

    spring boot集成quartz定时器

    Quartz 是一个开源的任务调度框架,可以用于创建、管理和执行计划任务。本文将详细讲解如何在Spring Boot项目中集成Quartz定时器,以及如何利用Spring的依赖注入特性来实现Job。 一、集成Quartz定时器 1. 添加依赖...

    springboot2.0整合quartz

    @Configuration @EnableScheduling public class QuartzConfig { @Bean public JobDetail myJob() { return JobBuilder.newJob(MyJob.class) .withIdentity("myJob", "group1") // 定义Job的名字和组名 .build...

    spring3整合quartz1.8和spring3整合quartz2.2两个版本示例

    Quartz 是一个强大的、开放源码的作业调度框架,用于在 Java 应用程序中创建和执行定时任务。本示例将探讨如何将 Spring 3 与 Quartz 1.8 和 2.2 版本进行整合,以实现高效的任务调度。 首先,我们来看 Spring 3 ...

    springboot2.3集成quartz定时任务持久化数据库,支持集群

    @Configuration public class QuartzConfig { @Autowired private SchedulerFactoryBean schedulerFactoryBean; @Bean public JobDetail myJobDetail() { return JobBuilder.newJob(MyJob.class) ....

    quartz

    Quartz 是一个强大的、开放源代码的作业调度框架,它为在 Java 应用程序中进行任务调度提供了灵活且可扩展的解决方案。Quartz 的基本配置对于正确设置和管理调度器至关重要,它允许用户定制调度器的行为以满足特定的...

    spring-boot-quartz

    Quartz 是一个开源的作业调度框架,常被用来执行定时任务。当我们结合 Spring Boot 和 Quartz,我们可以构建一个强大的定时任务管理系统,这在许多业务场景中非常有用,比如数据清理、报告生成、定期发送邮件等。 ...

    quartz-2.2.2-distribution.rar

    Quartz 是一个开源的作业调度框架,用于在 Java 应用程序中安排任务。它提供了丰富的 API 和配置选项,使得开发者能够轻松地实现定时任务的创建、管理和执行。标题中的 "quartz-2.2.2-distribution.rar" 指的是 ...

    官方 Quartz 2.2.2 Jar 包

    2. **Quartz_Scheduler_Configuration_Guide.pdf**:配置指南专注于如何配置 Quartz 的配置文件,`quartz.properties`。这个文件控制着 Quartz 的行为,如线程池大小、调度策略等。通过修改配置,你可以调整 Quartz ...

    common-quartz.zip

    这通常意味着添加`spring-boot-starter-quartz`或`quartz`以及`spring-boot-starter-jdbc`(如果Quartz需要持久化任务信息到数据库)的依赖项。 ```xml <groupId>org.springframework.boot <artifactId>spring-...

    springboot整合quartz,实现数据库方式执行定时任务

    @Configuration public class QuartzConfig { @Autowired private DataSource dataSource; @Bean public SchedulerFactoryBean schedulerFactoryBean() { SchedulerFactoryBean factory = new ...

    SpringBoot集成Quartz分布式定时任务

    在SpringBoot的配置类中,使用`@Configuration`和`@EnableScheduling`注解,并通过`@Autowired`注入`SchedulerFactoryBean`,编写方法来启动和配置Scheduler。 6. **注册Job和Trigger**: 在应用启动时,通过...

    SpringBoot整合Quartz任务定时调度

    而Quartz则是一款功能强大的作业调度库,它允许开发者定义、调度和执行任务。本篇文章将详细探讨如何在Spring Boot项目中整合Quartz实现任务定时调度。 首先,我们需要理解Spring Boot与Quartz的整合基础。Spring ...

    quartz-2.2.3-官方文档数据及PDM表结构.zip

    8. **配置(Configuration)**:Quartz的配置主要通过`quartz.properties`文件进行,包括数据库连接、线程池设置、JobStore选择等。此外,也可以通过代码方式进行动态配置。 综上所述,"quartz-2.2.3-官方文档数据...

    Quartz官方文档汉化教程

    ### Quartz官方文档汉化教程知识点解析 #### 一、Quartz简介与应用场景 Quartz是一个功能强大的开源作业调度框架,可以集成到Java应用程序中。它提供了丰富的特性来满足各种复杂的应用场景需求,如定时任务、周期...

Global site tag (gtag.js) - Google Analytics