java – 在Windows 7上没有执行Spring计划任务
发布时间:2020-12-15 02:35:03 所属栏目:Java 来源:网络整理
导读:我对计划任务有一种奇怪的行为.我有以下设置 task:scheduled-tasks task:scheduled ref="servicioEjecucionReportes" method="ejecutar" cron="0 0 * * * *" / task:scheduled ref="servicioEjecucionReportes" method="ejecutarReintentos" cron="0 30 * *
我对计划任务有一种奇怪的行为.我有以下设置
<task:scheduled-tasks> <task:scheduled ref="servicioEjecucionReportes" method="ejecutar" cron="0 0 * * * *" /> <task:scheduled ref="servicioEjecucionReportes" method="ejecutarReintentos" cron="0 30 * * * *" /> <task:scheduled ref="servicioEjecucionReportes" method="enviarReporteDiario" cron="0 15 0 * * *" /> </task:scheduled-tasks> 并且执行程序以这种方式配置: <task:annotation-driven executor="asyncExecutor" scheduler="taskScheduler" /> <task:executor id="asyncExecutor" rejection-policy="CALLER_RUNS" pool-size="16" /> <task:scheduler id="taskScheduler" pool-size="8" /> 问题是,我们正在使用linux和mac os开发并且三个任务得到正确执行,但在部署服务器上是Windows 7 Server,前两个正确执行而第三个没有. 我需要在00:15每天执行第三项任务. 我尝试过改变配置,但行为总是一样的,在开发和测试环境中,一切都运行良好,但不是在生产环境中. 我有点迷失在哪里看或有什么问题. bean声明如下: <bean id="servicioEjecucionReportes" class="com.mycompany.beans.ServicioEjecucionReportesImpl" /> 界面是: public interface ServicioEjecucionReportes { public void ejecutar(); public void ejecutarReintentos(); public void enviarReporteDiario(); } 编辑:额外信息,在服务器日志上,我们甚至没有看到尝试运行的任务,弹簧版本是3.1.0. 解决方法
Windows中的计划异步方法似乎存在问题.这与JVM如何在Windows上创建线程有关
尝试删除@Async并检查它是否有效 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |