如果想中斷執行中的job
在Quartz官網的FAQ有提到解決的辦法
Q:How do I stop a Job that is currently executing?
A:See the org.quartz.InterruptableJob interface
, and the Scheduler.interrupt(String, String) method.
透過Scheduler.interrupt(String jobName, String groupName)
則Scheduler會調用job的interrupt method
這裡有個前提
job必須implements InterruptableJob
否則會出現下面兩行的錯誤訊息
org.quartz.UnableToInterruptJobException: Job 'TestQjob' of group 'TestJob,
can not be interrupted, since it does not implement org.quartz.InterruptableJob
沒有留言:
張貼留言