本文介绍了如何中断或停止当前运行的石英作业?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些在Java Quartz Jobs的帮助下执行的任务,但我需要在我的代码中通过某些条件来停止某些任务。我读到这可以通过InterruptableJob完成。但是我不明白我该怎么办呢?

解决方案

你需要把你的工作写成一个实现。
要中断此工作,您需要处理,并调用中断(jobKey<<作业名称和作业组>>)




I have some tasks that are executed with the help of Java Quartz Jobs, but I need to stop some tasks by some condition in my code. I read that this can be done via InterruptableJob. But i didn't understand in what way i should do it?

解决方案

You need to write a your job as an implementation of InterruptableJob.To interrupt this job, you need handle to Scheduler , and call interrupt(jobKey<<job name & job group>>)

Please have a look @ javadoc for above classes, also quartz distribution contains an example for this (example7).

这篇关于如何中断或停止当前运行的石英作业?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 13:41