0
我已使用cronScheduler
與misfireInstruction
等的觸發如下關於Java的石英調度失火
trigger = newTrigger().withIdentity("autoLockTrigger", "autoLockGroup").startNow() .withSchedule(cronSchedule(croneExpression).withMisfireHandlingInstructionFireAndProceed())
.forJob("autoLockJob","autoLockGroup")
.build();
我quartz.properties就像如下
org.quartz.scheduler.instanceName =MyScheduler
# Configuring ThreadPool
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 1
org.quartz.threadPool.threadPriority = 9
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.dataSource = myDS
org.quartz.jobStore.tablePrefix = QRTZ_
#org.quartz.dataSource.myDS.jndiURL = jdbc/vikas
org.quartz.dataSource.myDS.driver = com.mysql.jdbc.Driver
org.quartz.dataSource.myDS.URL = jdbc:mysql://staging:3307/facao
org.quartz.dataSource.myDS.user = root
org.quartz.dataSource.myDS.password = toor
org.quartz.dataSource.myDS.maxConnections = 30
#org.quartz.jobStore.nonManagedTXDataSource = myDS
#to store data in string format (name-value pair)
org.quartz.jobStore.useProperties=true
org.quartz.jobStore.misfireThreshold = 60000
在我的代碼,如果我設置一些觸發器在特定的時間,如果服務器處於運行狀態,則調度程序正常運行,但如果服務器在調度程序假定運行的時間已關閉,然後在一段時間後啓動,則調度程序應運行失火指令。但在我的情況下,失誤的指令並非一直運行,而是一直運行一段時間,但並非總是如此,所以我的目的沒有實現。請給一些解決方案。先謝謝你。
你知道這個的任何理由嗎?有沒有線程問題,或者quartz.properties中是否存在缺少的設置?我說線程問題是因爲它有時會運行並且有時會失敗。所以一些優先級更高的線程可能正在運行。所以它可能會停止工作。 – man
會很好,如果您在此處提供您的cron表達式:-) – Shinchan
我正在動態生成crone表達式。最新是這個「0 14 12 6 6」?我測試了這個調度器。我剛下了服務器,並在15分鐘後重新啓動它。但失火指示不會被解僱。 – man