2012-06-21 67 views
4

我對計劃任務有一個奇怪的行爲。我有以下設置春天的計劃任務沒有在Windows 7上執行

<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。

+0

再次,這是炒作,但你可以只嘗試刪除拒絕策略?或將其更改爲「DISCARD_OLDEST」? –

回答

1

在Windows中似乎存在計劃異步方法的問題。這是在JVM如何在Windows創建線程

嘗試取出@Async有關,檢查是否正常工作

+0

是的,它的工作除去@Async,我真的很想知道爲什麼。 –

0

推測:您的任務在生產環境中有很長的運行時間 - ejecutarejecutarReintentos。我想知道的可能是你的asyncExecutor線程池已經耗盡了,這會觸發你的調度器上的Caller_RUNS,並且可能根本沒有更多的調度器池可用?

+0

兩個第一項任務持續1分鐘,並正確完成。前兩項任務每小時執行一次,沒有問題。 –

+0

好的。如果你僅僅安排第三項任務 - 或者安排它更頻繁地運行,那麼它會乾淨地運行,或者即使有這個問題,你也可能會遇到同樣的問題。 –

+0

我可以嘗試單獨安排時間,但不要改變頻率,因爲它是一種產品服務器,我也無法隨時部署。我會嘗試評論。 –