1. Quartz主要配置

属性名称 是否必选 类型 默认值 说明
org.quartz.scheduler.instanceName String QuartzScheduler Schedule调度器的实体名字
org.quartz.scheduler.instanceId String NON_CLUSTERED Schedule调度器的实体的Id,必须唯一。 1. 当你想生成intanceId的时候可以设置为AUTO 2. 当你想从系统属性org.quartz.scheduler.instanceId取值时可以设置为SYS_PROP
org.quartz.scheduler.instanceIdGenerator.class String(类名) org.quartz.simpl.SimpleInstanceIdGenerator 生成Schudule实体Id的类,只有在属性org.quartz.scheduler.instanceId设置为AUTO时使用,默认的实现org.quartz.scheduler.SimpleInstanceGenerator是基于主机名称和时间戳生成。其他的实现查看具体的文档
org.quartz.scheduler.threadName String instanceName + ‘_QuartzSchedulerThread’ Scheduler线程的名称
org.quartz.scheduler.makeSchedulerThreadDaemon boolean false 指定Scheduler是否以守护线程(服务)运行
org.quartz.scheduler.threadsInheritContextClassLoaderOfInitializer boolean false 目前不太理解
org.quartz.scheduler.idleWaitTime long 30000 当调度程序空闲时,在重新查询可用触发器之前,调度程序将等待毫秒的时间数。不建议少于5000ms,而少于1000是不合法的参数
org.quartz.scheduler.doFailureRetryInterval long 15000 使用JobStore(比如连接数据库)时Schueduler检测到失去数据库连接后重新尝试连接的毫秒数
org.quartz.scheduler.classLoadHelper.class String(类名) org.quartz.simpl.CascadingClassLoaderHelper 目前不太了解
org.quartz.scheduler.jobFactory.class String(类名) org.quartz.simpl.PropertySettingJobFctory 给Scheduler Context、Job、Trigger的JobDataMaps设置属性值的方式
org.quartz.contenxt.key.SOME_KEY String None 键值对,保存在Scheduler Context中,比如有这样的配置org.quartz.shceduler.key.MyKey=MyValue,则在Scheduler Context中赋值方式为scheduler.getContext().put(“MyKey”, “MyValue”
org.quartz.scheduler.userTransactionURL String(url) java:comp/UserTransaction 事务管理JNDI URL地址。只有当Quartz使用JobStoreCMT和org.quartz.scheduler.wrapJobExecutionInUserTransaction 设置为true时使用
org.quartz.scheduler.wrapJobExecutionInUserTransaction boolean false 只有当你在执行一个Job时想使用UserTransaction时设置为true,参考@ExecuteInJTATransaction 注解
org.quartz.scheduler.skipUpdateCheck boolean false 是否跳过版本检测。可以设置系统参数org.terracotta.quartz.skipUpdateCheck=true或者在JAVA命令行使用-D选项。在正式库运行时应设置为true。
org.quartz.scheduler.batchTriggerAcquisitionMaxCount int 1 在同一时间运行Scheduler获取trigger的数量。如果设置的数量>1,并且使用JDBC JobStore,则属性org.quartz.jobStore.acquireTriggersWithinLock应设置为true,可以避破坏数据。
org.quartz.scheduler.batchTriggerAcquisitionFireAheadTimeWindow long 0 运行Scheduler在获取和触发tigger的提前的时间。

2. 线程池配置

2.1 主要配置

属性名称 是否必选 类型 默认值 说明
org.quartz.threadPool.class String(类名) null Scheduler使用的线程池名称,实现了ThreadPool接口,参考org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount int -1 线程池里面的线程的数据,取值在1-100
org.quartz.threadPool.threadPriority int Thread.NORM_PRIORITY (5) 线程的优先级,取值在Thread.MIN_PRIORITY(1)到Threa.MAX_PRIORITY(10)

2.2 线程池的简单配置

属性名称 是否必选 类型 默认值 说明
org.quartz.threadPool.makeThreadsDaemons boolean fale 指定在线程池里面创建的线程是否是守护线程
org.quartz.threadPool.threadsInheritGroupOfInitializingThread boolean true
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread boolean false
org.quartz.threadPool.threadNamePrefix String [Scheduler Name]_Workder 指定线程池里面线程的名字的前缀

3. Listener配置

在实例化StdSchedulerFactory的时候可以注册一个全局的监听器到Scheduler中,全局监听器会监听每一个Job和Trigger的触发事件。
全局监听器必选有一个无参的构造函数,并且属性值只能是基本类型(包括String)。

配置例子:

//trigger listener配置
org.quartz.triggerListener.NAME = package.className
org.quartz.triggerListener.NAME.propName = propValue
//job listener配置
org.quartz.jobListener.NAME = package.className
org.quartz.jobListener.NAME.propName = propValue
123456

4. JobStore配置

JobStore是Scheduler在运行时用来存储相关的信息的,比如Job, Trigger。

4.1 RAMJobStore

RAMJobStore实现类是在内存中存储信息的,程序一旦结束便丢失了相关的信息。

属性名称 是否必选 类型 默认值 说明
org.quartz.jobStore.class String(类名) org.quartz.simpl.RAMJobStore 指定使用的JobStore
org.quartz.jobStore.misfireThreshold int 60000 触发器失败后下次触发的时间间隔

4.2 JDBCJobStore和JobStoreTX

JDBCJobStore和JobStoreTX都使用关系数据库来存储Schedule相关的信息。

JobStoreTX在每次执行任务后都使用commint或者rollback来提交更改。

如果在一个标准的独立应用或者在一个没有使用JTA事务管理的应用中使用Quartz,JDBCJobStore是一个不错的选择。

JobStoreTX的配置如下:

属性名称 是否必选 类型 默认值 说明
org.quartz.jobStore.class String(类名) org.quartz.simpl.jdbcjobstore.JobStoreTX 使用JobStoreTX
org.quartz.jobStore.driverDelegateClass String(类名) null 使用的数据库驱动,具体的驱动列表详情如下
org.quartz.jobStore.dataSource String null 使用的数据源名称,具体参照数据源配置
org.quartz.jobStore.tablePrefix String QRTZ_ 表的前缀
org.quartz.jobStore.userProperties boolean false 标示在JobDataMaps的数据全部是String
org.quartz.jobStore.misfireThreshold int 60000 触发器触发失败后再次触犯的时间间隔
org.quartz.jobStore.isClustered boolean false 如果有多个调度器实体的话则必须设置为true
org.quartz.jobStore.clusterCheckinInterval long 15000 检查集群下的其他调度器实体的事件间隔
org.quartz.jobStore.maxMisfiresToHandleAtATime int 20
org.quartz.jobStore.dontSetAutoCommintFalse boolean false
org.quartz.jobStore.selectWithLockSQL String select * from {0}locks where sched_name = {1} and lock_name = ? for update
org.quartz.jobStore.txlsolationLevelSerializable boolean false
org.quartz.jobStore.acquireTriggersWithinLocal boolean false
org.quartz.jobStore.lockHandler.class String null
org.quartz.jobStore.driverDelegateInitString String null

4.2.1 org.quartz.jobStore.driverDelegateClass数据库驱动列表

  • org.quartz.impl.jdbcstore.StdJDBCDelegate 适用于完全兼容JDBC的驱动
  • org.quartz.impl.jdbcstore.MSSQLDelegate 适用于Miscrosoft SQL Server和Sybase数据库
  • org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
  • org.quartz.impl.jdbcjobstore.WebLogicDelegate
  • org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
  • org.quartz.impl.jdbcjobstore.oracle.WebLogicOracleDelegate
  • org.quartz.impl.jdbcjobstore.oracle.weblogic.WebLogicOracleDelegate
  • org.quartz.impl.jdbcjobstore.CloudscapeDelegate
  • org.quartz.impl.jdbcjobstore.DB2v6Delegate
  • org.quartz.impl.jdbcjobstore.DB2v7Delegate
  • org.quartz.impl.jdbcjobstore.DB2v8Delegate
  • org.quartz.impl.jdbcjobstore.HSQLDBDelegate
  • org.quartz.impl.jdbcjobstore.PointbaseDelegate
  • org.quartz.impl.jdbcjobstore.SybaseDelegate

5. 集群,使用JDBCJobStore和JobStoreTX

在JobStore使用JDBCJobStore、JobStoreTX、JobStoreCMT的情况下可以使用Quartz的集群特性,示意图如下:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-9gUw9lxE-1600909146358)(http://i.imgur.com/t2sYsyp.png)]

简单的配置如下:

//主要配置
org.quartz.scheduler.instanceName = MyClusteredScheduler
org.quartz.scheduler.instanceId = AUTO//配置数据池连接
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 25
org.quartz.threadPool.treadPriority = 5//JobStore配置
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcstore.oracle.OracleDelegate
org.quartz.jobStore.userProperties = true
org.quartz.jobStore.dataSource = myDS
org.quartz.jobStore.misfireThreshold = 60000org.quartz.jobStore.isClustered = true
org.quartz.jobStore.clusterCheckinInterval = 20000//DataSource数据源配置
org.quartz.dataSource.myDS.driver = oracle.jdbc.driver.OracleDriver
org.quartz.dataSource.myDS.URL = jdbc:oracle:thin:@localhost:1521:dev
org.quartz.dataSource.myDS.user = quartz
org.quartz.dataSource.myDS.password = quartz
org.quartz.dataSource.myDS.maxConnections = 5
org.quartz.dataSource.myDS.validationQuery=select 0 from dual
uartz.dataSource.myDS.password = quartz
org.quartz.dataSource.myDS.maxConnections = 5
org.quartz.dataSource.myDS.validationQuery=select 0 from dual

Quartz配置信息相关推荐

  1. quartz配置_基于spring-boot 2.x +quartz 的CRUD任务管理系统

    基于spring-boot 2.x + quartz 的CRUD任务管理系统,适用于中小项目. 开发环境 JDK1.8.Maven.Eclipse 技术栈 SpringBoot 2.0.1.thyme ...

  2. 关于Asp.net core配置信息读取的源码分析梳理

    概述 我们都知道asp.net core配置信息的读取离不开IConfigurationSource和IConfigurationProvider这两个类,ConfigurationSource可以提 ...

  3. 使用spring+quartz配置多个定时任务

    首先引入 quartz jar包: 创建java类: package com.tcwl.vsmp.loanmgt.message;import com.tcwl.vsmp.external.const ...

  4. maven Web项目中POM的配置信息

    什么是POM? POM是项目对象模型(Project Object Model)的简称,它是Maven项目中的文件,使用XML表示,名称叫做pom.xml.在Maven中,当谈到Project的时候, ...

  5. 集群环境下,谁偷走quartz配置的定时任务

    错误现象: 在本地开发环境中,应用服务启动后TRIGGER_STATE直接就变为ERROR 前段时间在项目中,使用quartz配置一个定时任务,定时任务都持久化到oracle数据库中,但是应用服务器启 ...

  6. Quartz配置和运用详解

    本文转自:http://topmanopensource.iteye.com/blog/1123824 最近工作需要学习quartz,那么必须首先了解三个概念: 调度器:负责调度作业和触发器: 触发器 ...

  7. 在Ubuntu 14.04 64bit上查看硬件配置信息

    陪伴我多年的老本ThinkPad T420渐渐垂垂老矣, 我想更新一下可以更新的部分, 比如将2.5寸HDD更换为SSD, 将单条4G内存再增加一根, 凡此种种想法, 可能最后归结为如何获取该笔记本的 ...

  8. Django项目准备和配置(MVT图解、创建项目和应用、更换解释器、安装应用、本地化、模板路径、项目中匹配urls、应用中匹配urls.py、准备视图、开启服务器、修改DATABAS配置信息)

    Django模型主要包含: 模型配置 数据的增删改 增:book = BookInfo() book.save() 和BookInfo.objects.create() 删:book.delete() ...

  9. springboot 加载配置信息(静态)

    springboot 加载配置信息(静态) 举例:动态设置验证码过期时间 application-uat.properties配置(文件路径:/src/main/resources/applicati ...

  10. 在.net中使用强类型来读取配置信息

    在.net应用中,配置信息以XML文档的形式来存储.依.net的惯例,web.config为Asp.net应用(包括Web Service应用)提供配置信息:而*.exe.config为可执行的应用( ...

最新文章

  1. 聊天软件系统测试用例,QQ聊天框测试用例设计
  2. gp338信令_【对讲机的那点事】摩托罗拉GP338的MDC1200信令选呼如何编程?
  3. 蛋白质:结构和功能 Proteins: Structure and Function
  4. C++ 文件读写操作01
  5. java获取数组穷举_被BAT疯抢的Java工程师,都是怎么拿到年薪50W的offer
  6. linux nice启动vi程序,Linux nice命令
  7. Oracle 列转行函数 Listagg()
  8. 网站服务器部署及优化---2---部署wordpress网站(rhel6.5)
  9. Unix/Linux编程:Unix文件系统回顾
  10. 怎么对linux系统的硬盘检测,详解Linux系统中hdparm硬盘检测工具的使用
  11. 数据分析师面试题目_数据分析师面试题目
  12. 当当网商品详情API接口(当当商品详情接口,当当商品问答接口,当当抢购价接口,当当商品列表接口,当当商品评论接口)代码对接教程
  13. java到达时间后自动执行代码_java设置按时间自动执行
  14. 【bat/batch】bat中的转义字符
  15. 使用Route报错:A <Route> is only ever to be used as the child of <Routes> element, never rendered directl
  16. 阿里云的认证是不是最好的?考起来难不难?
  17. SSM思想—阶段性总结
  18. 每日算法 - 列出24点游戏的所有解法
  19. 关于优秀的管理者学习笔记
  20. RT-Thread应用实战-TI温湿度HDC1000软件包设计与制作

热门文章

  1. SecoClient 接收返回码超时
  2. Mac 有道词典 无法取词、划词
  3. 简单的网页编辑器js代码
  4. VISIO科学图形包-亲测VISIO2013可用,应该适用其他高级版本
  5. 【写博客常用】美赛成绩如何快速查询!
  6. 注册测绘师学习笔记(二)
  7. Intel Fortran编译器安装
  8. Log4cpp 安装和使用
  9. 12864 c语言,单片机12864 c程序
  10. Web视频播放总结,avi、swf、兼容IE6/7/8