這些屬性配置了調(diào)度程序的標識,以及各種其他“頂級”設(shè)置。
Property Name | Req'd | 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.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
可以是任何字符串,并且該值對調(diào)度程序本身沒有意義,而是作為客戶端代碼在同一程序中使用多個實例時區(qū)分調(diào)度程序的機制。如果您正在使用群集功能,則必須對群集中“邏輯上”相同的調(diào)度程序的每個實例使用相同的名稱。
org.quartz.scheduler.instanceId
可以是任何字符串,但對于所有調(diào)度程序來說,必須是唯一的,就像它們在集群中是相同的“邏輯”調(diào)度程序一樣。如果希望為您生成Id,則可以使用值“AUTO”作為instanceId?;蛘呷绻阆胍@個值來自系統(tǒng)屬性“org.quartz.scheduler.instanceId”的值“SYS_PROP”。
org.quartz.scheduler.instanceIdGenerator.class
僅當org.quartz.scheduler.instanceId設(shè)置為“AUTO” 時才使用。默認為“org.quartz.simpl.SimpleInstanceIdGenerator”,它根據(jù)主機名和時間戳生成實例ID。其他IntanceIdGenerator實現(xiàn)包括SystemPropertyInstanceIdGenerator(它從系統(tǒng)屬性“org.quartz.scheduler.instanceId”獲取實例ID,HostnameInstanceIdGenerator使用本地主機名(InetAddress.getLocalHost()。getHostName()),還可以實現(xiàn)InstanceIdGenerator接口你的自我。
org.quartz.scheduler.threadName
可以是java線程的有效名稱的任何字符串。如果未指定此屬性,線程將接收調(diào)度程序的名稱(“org.quartz.scheduler.instanceName”)加上附加的字符串“_QuartzSchedulerThread”。
org.quartz.scheduler.makeSchedulerThreadDaemon
一個布爾值('true'或'false'),指定調(diào)度程序的主線程是否應該是守護線程。另請參見org.quartz.scheduler.makeSchedulerThreadDaemon屬性來調(diào)優(yōu)SimpleThreadPool,如果這是您正在使用的線程池實現(xiàn)(最有可能是這種情況)。
org.quartz.scheduler.threadsInheritContextClassLoaderOfInitializer
一個布爾值('true'或'false'),用于指定Quartz產(chǎn)生的線程是否會繼承初始化線程(初始化Quartz實例的線程)的上下文ClassLoader。這將影響Quartz主調(diào)度線程,JDBCJobStore的失火處理線程(如果使用JDBCJobStore),集群恢復線程(如果使用集群)和SimpleThreadPool中的線程(如果使用SimpleThreadPool)。將此值設(shè)置為“true”可能有助于類加載,JNDI查找以及與應用程序服務器中使用Quartz相關(guān)的其他問題。
org.quartz.scheduler.idleWaitTime
在調(diào)度程序處于空閑狀態(tài)時,調(diào)度程序?qū)⒃谥匦虏樵兛捎糜|發(fā)器之前等待的時間量(以毫秒為單位)。通常,您不必“調(diào)整”此參數(shù),除非您使用XA事務,并且在觸發(fā)器延遲觸發(fā)時立即出現(xiàn)問題。不推薦使用小于5000毫秒的值,因為它會導致過多的數(shù)據(jù)庫查詢。小于1000的價值不合法。
org.quartz.scheduler.dbFailureRetryInterval
當調(diào)查器檢測到JobStore中的連接丟失(例如數(shù)據(jù)庫)時,調(diào)度程序?qū)⒃谥卦囍g等待的時間量(以毫秒為單位)。當使用RamJobStore時,此參數(shù)顯然不是很有意義。
org.quartz.scheduler.classLoadHelper.class
默認是最健壯的方法,它是使用“org.quartz.simpl.CascadingClassLoadHelper”類,它依次使用每個其他ClassLoadHelper類,直到一個工作。您應該可能找不到需要為此屬性指定任何其他類,盡管在應用程序服務器中似乎發(fā)生了奇怪的事情。所有當前可能的ClassLoadHelper實現(xiàn)都可以在org.quartz.simpl包中找到。
org.quartz.scheduler.jobFactory.class
要使用的JobFactory的類名。JobFatcory負責生成JobClasses的實例。默認值為“org.quartz.simpl.PropertySettingJobFactory”,它只需在類上調(diào)用newInstance()即可在每次執(zhí)行即將發(fā)生時生成一個新的實例。PropertySettingJobFactory還使用SchedulerContext和Job和Trigger JobDataMaps的內(nèi)容來反映設(shè)置作業(yè)的bean屬性。
org.quartz.context.key.SOME_KEY
表示將作為字符串放入“調(diào)度程序上下文”的名稱 - 值對。(見Scheduler.getContext())。所以例如,設(shè)置“org.quartz.context.key.MyKey = MyValue”將執(zhí)行與scheduler.getContext()等效的put(“MyKey”,“MyValue”)。
除非使用JTA事務,否則事務相關(guān)屬性應該不在配置文件中。
org.quartz.scheduler.userTransactionURL
應設(shè)置為Quartz可以找到Application Server的UserTransaction管理器的JNDI URL。默認值(如果未指定)為“java:comp / UserTransaction” - 幾乎適用于所有應用程序服務器。Websphere用戶可能需要將此屬性設(shè)置為“jta / usertransaction”。僅當Quartz配置為使用JobStoreCMT,并將org.quartz.scheduler.wrapJobExecutionInUserTransaction設(shè)置為true 時才使用此操作。
org.quartz.scheduler.wrapJobExecutionInUserTransaction
如果您希望Quartz在您的工作調(diào)用執(zhí)行之前啟動UserTransaction,應設(shè)置為“true”。在作業(yè)執(zhí)行方法完成后,JobDataMap更新后(如果它是StatefulJob),Tx將提交。默認值為“false”。您可能還有興趣在您的作業(yè)類上使用@ExecuteInJTATransaction注釋,該批注可以控制單個作業(yè),無論Quartz是否應啟動JTA事務 - 而此屬性會導致所有作業(yè)發(fā)生。
org.quartz.scheduler.skipUpdateCheck
是否跳過運行快速Web請求以確定是否有可更新的Quartz版本可供下載。如果檢查運行,并且找到更新,則會在Quartz的日志中報告它。您也可以使用系統(tǒng)屬性“org.terracotta.quartz.skipUpdateCheck = true”(可以在系統(tǒng)環(huán)境中設(shè)置或在java命令行上設(shè)置為-D)來禁用更新檢查。建議您禁用生產(chǎn)部署的更新檢查。
org.quartz.scheduler.batchTriggerAcquisitionMaxCount
允許調(diào)度程序節(jié)點一次獲取(用于觸發(fā))的觸發(fā)器的最大數(shù)量。默認值為1.數(shù)字越大,觸發(fā)效率越高(在需要很多觸發(fā)器的情況下需要同時觸發(fā)) - 但是以群集節(jié)點之間可能的不平衡負載為代價。如果此屬性的值設(shè)置為> 1,并使用JDBC JobStore,則必須將屬性“org.quartz.jobStore.acquireTriggersWithinLock”設(shè)置為“true”以避免數(shù)據(jù)損壞。
org.quartz.scheduler.batchTriggerAcquisitionFireAheadTimeWindow
允許觸發(fā)器在其預定的火災時間之前被獲取和觸發(fā)的時間(毫秒)的時間量。默認值為0.數(shù)量越大,觸發(fā)器觸發(fā)器的批次獲取越有可能一次可以選擇和觸發(fā)超過1個觸發(fā)器 - 以觸發(fā)計劃為代價不準確地被觸發(fā)(觸發(fā)器可能會提早啟動該數(shù)量)。在調(diào)度程序具有非常大數(shù)量的觸發(fā)器需要在或接近同一時間點觸發(fā)的情況下,這可能是有用的(為了表現(xiàn)的緣故)。
更多建議: