主配置調度器設置
屬性名稱 | 是否必要 | 類型 | 默認值 |
---|---|---|---|
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
- instanceId生成器
- 僅當instanceId設置爲AUTO時才使用。
- org.quartz.simpl.SimpleInstanceIdGenerator(默認)
- 它根據主機名和時間戳生成實例ID。
- SystemPropertyInstanceIdGenerator
- 它從系統屬性org.quartz.scheduler.instanceId獲取實例ID
- HostnameInstanceIdGenerator
- 使用本地主機名(InetAddress.getLocalHost()。getHostName()),
- 可以實現InstanceIdGenerator接口自定義Id
org.quartz.scheduler.threadName
- 線程名稱
- 可爲任何值
- 默認org.quartz.scheduler.instanceName+"_QuartzSchedulerThread"
org.quartz.scheduler.makeSchedulerThreadDaemon
- 指定調度程序的主線程是否應該是守護線程
- 'true'或'false'
org.quartz.scheduler.threadsInheritContextClassLoaderOfInitializer
- 指定Quartz產生的線程是否會繼承初始化線程(初始化Quartz實例的線程)的上下文ClassLoader。
- 影響Quartz主調度線程,JDBCJobStore的失火處理線程(如果使用JDBCJobStore),集羣恢復線程(如果使用集羣)和SimpleThreadPool中的線程(如果使用SimpleThreadPool)。
- 將此值設置爲"true"可能有助於類加載,JNDI查找以及與應用程序服務器中使用Quartz相關的其他問題。
- 'true'或'false'
org.quartz.scheduler.idleWaitTime
- 在調度程序處於空閒狀態時,調度程序將在重新查詢可用觸發器之前等待的時間量(以毫秒爲單位)。
- 通常,您不必"調整"此參數,除非您使用XA事務,並且在觸發器延遲觸發時立即出現問題。
- 不推薦使用小於5000毫秒的值,因爲它會導致過多的數據庫查詢。
- 小於1000的毫秒不合法。
org.quartz.scheduler.dbFailureRetryInterval
- 當調查器檢測到JobStore中的連接丟失(例如數據庫)時,調度程序將在重試之間等待的時間量(以毫秒爲單位)。
- 當使用RamJobStore時,此參數顯然不是很有意義。
org.quartz.scheduler.classLoadHelper.class
- 默認是最健壯的方法,它是使用"org.quartz.simpl.CascadingClassLoadHelper"類,
- 它依次使用每個其他ClassLoadHelper類,直到一個工作。
- 您應該可能找不到需要爲此屬性指定任何其他類,儘管在應用程序服務器中似乎發生了奇怪的事情。
- 所有當前可能的ClassLoadHelper實現都可以在org.quartz.simpl包中找到。
org.quartz.scheduler.jobFactory.class
- 要使用的JobFactory的類名。
- JobFatcory負責生成JobClasses的實例。
- 默認值爲"org.quartz.simpl.PropertySettingJobFactory"
- 它只需在類上調用newInstance()就可在每次執行即將發生時生成一個新的實例。
- PropertySettingJobFactory還使用SchedulerContext和Job和Trigger,JobDataMaps的內容來反映設置作業的bean屬性。
org.quartz.context.key.SOME_KEY
- 表示將作爲字符串放入"調度程序上下文"的鍵-值對。
- 例如,設置"org.quartz.context.key.MyKey = MyValue"將執行與scheduler.getContext()等效的put("MyKey","MyValue")。
- 除非使用JTA事務,否則事務相關屬性應該不在配置文件中。
org.quartz.scheduler.userTransactionURL
- 應設置爲Quartz可以找到Application Server的UserTransaction管理器的JNDI URL。
- 默認值:"java:comp / UserTransaction"
- 幾乎適用於所有應用程序服務器。
- Websphere用戶可能需要將此屬性設置爲"jta / usertransaction"。
- 僅當Quartz配置爲使用JobStoreCMT,並將org.quartz.scheduler.wrapJobExecutionInUserTransaction設置爲true時才使用此操作。
org.quartz.scheduler.wrapJobExecutionInUserTransaction
- 如果您希望Quartz在您的工作調用執行之前啓動UserTransaction,應設置爲"true"。在作業執行方法完成後,JobDataMap更新後(如果它是StatefulJob),Tx將提交。
- 默認值爲"false"。
- 您可能還有興趣在您的作業類上使用@ExecuteInJTATransaction註釋,該批註可以控制單個作業,無論Quartz是否應啓動JTA事務,而此屬性會導致所有作業發生。
org.quartz.scheduler.skipUpdateCheck
- 是否跳過運行快速Web請求以確定是否有可更新的Quartz版本可供下載。
- 如果檢查運行,並且找到更新,則會在Quartz的日誌中報告它。
- 您也可以使用系統屬性"org.terracotta.quartz.skipUpdateCheck = true"(可以在系統環境中設置或在java命令行上設置爲-D)來禁用更新檢查。
- 生產部署建議禁用
org.quartz.scheduler.batchTriggerAcquisitionMaxCount
- 允許調度程序節點一次獲取(用於觸發)的觸發器的最大數量。
- 默認值爲1
- 數字越大,觸發效率越高(在需要很多觸發器的情況下需要同時觸發)
- 以羣集節點之間可能的不平衡負載爲代價。
- 如果此屬性的值設置爲> 1,並使用JDBC JobStore,則必須將屬性"org.quartz.jobStore.acquireTriggersWithinLock"設置爲"true"以避免數據損壞。
org.quartz.scheduler.batchTriggerAcquisitionFireAheadTimeWindow
- 允許觸發器在其預定的火災時間之前被獲取和觸發的時間(毫秒)的時間量。
- 默認值爲0
- 數量越大,觸發器觸發器的批次獲取越有可能一次可以選擇和觸發超過1個觸發器
- 以觸發計劃爲代價不準確地被觸發(觸發器可能會提早啓動該數量)。
- 在調度程序具有非常大數量的觸發器需要在或接近同一時間點觸發的情況下,這可能是有用的(爲了表現的緣故)。