我在 Spring 项目中创建了两个工作,它们在两个不同的时间运行,彼此独立。
public class JobA extends QuartzJobBean
{
@Override
protected void executeInternal(JobExecutionContext arg0)throws JobExecutionException
{
// my actual work
}
}
和
public class JobB extends QuartzJobBean
{
@Override
protected void executeInternal(JobExecutionContext arg0)throws JobExecutionException
{
// my actual work
}
}
两者在给定时间都运行良好,但我需要提供一些监视器功能,通过它我们可以检查作业是否正在运行。
我遇到了JobListener并且也看到了其他资源,但在实施时感到困惑。我不知道如何在Spring Controller中使用此侦听器,以便我可以在我的 jsp 中监视这两项工作。
更新:我正在使用 Quartz 1.8。如何检查是否有作业停止?有什么方法可以重新启动任何暂停或损坏的工作?