Spring 调度程序意外停止并重新启动 [英] Spring scheduler is stopping unexpectedly and starting again

查看:65
本文介绍了Spring 调度程序意外停止并重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有将近 70 个作业正在使用 spring 作业调度程序运行.其中 5 个是日常工作,其中 20 个是每周工作,其余的将每月运行.

I have nearly 70 jobs which are running using spring job scheduler. 5 of them are daily jobs, 20 of them are weekly jobs and remaining will run monthly.

我在applicationContext.xml文件中配置如下

即使我配置了 50 个线程,我仍然面临这些问题.

Even though I configured 50 threads still I am facing the issues.

问题:并非所有日常作业都在每天运行.下面列出了 8 天运行的作业详细信息

Problem: all daily jobs are not running daily.The jobs running details for 8 days are listed below

 Job_Number   No.Of times Ran
  ----------   ---------------
     1              8
     2              6
     3              4
     4              8
     5              7

我无法理解为什么会发生这种情况.我做了很多搜索仍然没有找到解决方案.请给我建议..

I am unable to understand why it is happening. I did lot of search still did not found solution.Please suggest me on this..

出于测试目的,我也评论了我的整个业务逻辑(意味着我只安排了空方法).即使在这种情况下,我也遇到了同样的问题.

For testing purpose I commented my entire business logic as well(Means I scheduled just empty methods).Even in this scenario also I got the same problem.

我指定的 cron 表达式如下

I specified cron expressions as follows

monthly_cron_expression = 0 00 02 15 * ?
weekly_cron_expression = 0 00 03 ? * FRI
daily_cron_expression = 0 5 10 * * ?

推荐答案

你能不能把日常工作的chron表达式改成如下试试Daily_cron_expression = 0 5 10 * * *

could you change the chron expresson for the daily job as follows and give a try daily_cron_expression = 0 5 10 * * *

这篇关于Spring 调度程序意外停止并重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆