Quartz配置说明

 主配置调度器设置

属性名称 是否必要 类型 默认值
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.PropertySettingJobFactory
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

.batchTriggerAcquisitionMaxCount

no int 1

org.quartz.scheduler

.batchTriggerAcquisitionFireAheadTimeWindow

no long 0

org.quartz.scheduler.instanceName

可为任何值,但在集群中必须使用相同的

org.quartz.scheduler.instanceId

属性为AUTO即可,自动生成id

org.quartz.scheduler.instanceIdGenerator.class

  1. instanceId生成器
  2. 仅当instanceId设置为AUTO时才使用。
  3. org.quartz.simpl.SimpleInstanceIdGenerator(默认)
    1. 它根据主机名和时间戳生成实例ID。
  4. SystemPropertyInstanceIdGenerator
    1.  它从系统属性org.quartz.scheduler.instanceId获取实例ID
  5. HostnameInstanceIdGenerator
    1. 使用本地主机名(InetAddress.getLocalHost()。getHostName()),
  6. 可以实现InstanceIdGenerator接口自定义Id


org.quartz.scheduler.threadName

  1. 线程名称
  2. 可为任何值
  3. 默认org.quartz.scheduler.instanceName+"_QuartzSchedulerThread"

org.quartz.scheduler.makeSchedulerThreadDaemon

  1. 指定调度程序的主线程是否应该是守护线程
  2. 'true'或'false'


org.quartz.scheduler.threadsInheritContextClassLoaderOfInitializer

 

  1. 指定Quartz产生的线程是否会继承初始化线程(初始化Quartz实例的线程)的上下文ClassLoader。
  2. 影响Quartz主调度线程,JDBCJobStore的失火处理线程(如果使用JDBCJobStore),集群恢复线程(如果使用集群)和SimpleThreadPool中的线程(如果使用SimpleThreadPool)。
  3. 将此值设置为"true"可能有助于类加载,JNDI查找以及与应用程序服务器中使用Quartz相关的其他问题。
  4. 'true'或'false'

 

org.quartz.scheduler.idleWaitTime

 

  1. 在调度程序处于空闲状态时,调度程序将在重新查询可用触发器之前等待的时间量(以毫秒为单位)。
  2. 通常,您不必"调整"此参数,除非您使用XA事务,并且在触发器延迟触发时立即出现问题。
  3. 不推荐使用小于5000毫秒的值,因为它会导致过多的数据库查询。
  4. 小于1000的毫秒不合法。

org.quartz.scheduler.dbFailureRetryInterval

  1. 当调查器检测到JobStore中的连接丢失(例如数据库)时,调度程序将在重试之间等待的时间量(以毫秒为单位)。
  2. 当使用RamJobStore时,此参数显然不是很有意义。

org.quartz.scheduler.classLoadHelper.class

  1. 默认是最健壮的方法,它是使用"org.quartz.simpl.CascadingClassLoadHelper"类,
  2. 它依次使用每个其他ClassLoadHelper类,直到一个工作。
  3. 您应该可能找不到需要为此属性指定任何其他类,尽管在应用程序服务器中似乎发生了奇怪的事情。
  4. 所有当前可能的ClassLoadHelper实现都可以在org.quartz.simpl包中找到。

org.quartz.scheduler.jobFactory.class

  1. 要使用的JobFactory的类名。
  2. JobFatcory负责生成JobClasses的实例。
  3. 默认值为"org.quartz.simpl.PropertySettingJobFactory"
  4. 它只需在类上调用newInstance()就可在每次执行即将发生时生成一个新的实例。
  5. PropertySettingJobFactory还使用SchedulerContext和Job和Trigger,JobDataMaps的内容来反映设置作业的bean属性。

org.quartz.context.key.SOME_KEY

  1. 表示将作为字符串放入"调度程序上下文"的键-值对。
  2. 例如,设置"org.quartz.context.key.MyKey = MyValue"将执行与scheduler.getContext()等效的put("MyKey","MyValue")。
  3. 除非使用JTA事务,否则事务相关属性应该不在配置文件中。


org.quartz.scheduler.userTransactionURL

  1. 应设置为Quartz可以找到Application Server的UserTransaction管理器的JNDI URL。
  2. 默认值:"java:comp / UserTransaction"
  3. 几乎适用于所有应用程序服务器。
  4. Websphere用户可能需要将此属性设置为"jta / usertransaction"。
  5. 仅当Quartz配置为使用JobStoreCMT,并将org.quartz.scheduler.wrapJobExecutionInUserTransaction设置为true时才使用此操作。

org.quartz.scheduler.wrapJobExecutionInUserTransaction

  1. 如果您希望Quartz在您的工作调用执行之前启动UserTransaction,应设置为"true"。在作业执行方法完成后,JobDataMap更新后(如果它是StatefulJob),Tx将提交。
  2. 默认值为"false"。
  3. 您可能还有兴趣在您的作业类上使用@ExecuteInJTATransaction注释,该批注可以控制单个作业,无论Quartz是否应启动JTA事务,而此属性会导致所有作业发生。

org.quartz.scheduler.skipUpdateCheck

  1. 是否跳过运行快速Web请求以确定是否有可更新的Quartz版本可供下载。
  2. 如果检查运行,并且找到更新,则会在Quartz的日志中报告它。
  3. 您也可以使用系统属性"org.terracotta.quartz.skipUpdateCheck = true"(可以在系统环境中设置或在java命令行上设置为-D)来禁用更新检查。
  4. 生产部署建议禁用

org.quartz.scheduler.batchTriggerAcquisitionMaxCount

  1. 允许调度程序节点一次获取(用于触发)的触发器的最大数量。
  2. 默认值为1
  3. 数字越大,触发效率越高(在需要很多触发器的情况下需要同时触发)
  4.  以群集节点之间可能的不平衡负载为代价。
  5.  如果此属性的值设置为> 1,并使用JDBC JobStore,则必须将属性"org.quartz.jobStore.acquireTriggersWithinLock"设置为"true"以避免数据损坏。

org.quartz.scheduler.batchTriggerAcquisitionFireAheadTimeWindow

  1. 允许触发器在其预定的火灾时间之前被获取和触发的时间(毫秒)的时间量。
  2. 默认值为0
  3. 数量越大,触发器触发器的批次获取越有可能一次可以选择和触发超过1个触发器
  4. 以触发计划为代价不准确地被触发(触发器可能会提早启动该数量)。
  5. 在调度程序具有非常大数量的触发器需要在或接近同一时间点触发的情况下,这可能是有用的(为了表现的缘故)。

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章