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. 在調度程序具有非常大數量的觸發器需要在或接近同一時間點觸發的情況下,這可能是有用的(爲了表現的緣故)。

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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