2011-08-24 2 views
0

작업 스케줄러에 이상한 문제가 있습니다. 다음은 에 pingProducer의 세 가지 테스트 구성입니다. 첫 번째와 두 번째 작업. 매 시간마다 ping을 생성해야하는 세 번째 팀은 매분마다 ping을 생성합니다. 내가 놓친 게 있니?스프링 - 작업 스케줄러 문제

<!-- Ping scheduler - WORKS - every second --> 
<task:scheduled-tasks> 
    <task:scheduled ref="pingProducer" method="producePingRequest" cron="* * * * * ?" /> 
</task:scheduled-tasks> 

<!-- Ping scheduler - WORKS - every minute --> 
<task:scheduled-tasks> 
    <task:scheduled ref="pingProducer" method="producePingRequest" cron="0 * * * * ?" /> 
</task:scheduled-tasks> 

<!-- Ping scheduler - DOES NOT WORK - every minute --> 
<task:scheduled-tasks> 
    <task:scheduled ref="pingProducer" method="producePingRequest" cron="0 0 * * * ?" /> 
</task:scheduled-tasks> 

답변

2

변경하려면 다음

<task:scheduled-tasks> 
    <task:scheduled ref="pingProducer" method="producePingRequest" cron="50 0 * * * ?" /> 
</task:scheduled-tasks> 

편집 : 시간 당 한 번, 50 초

+0

왜 즉시 실행하지 않고 50 초에 실행해야합니까? – user219882

+0

그것은 단지 예일뿐입니다 – atrain

+1

하지만 여전히 작동하지 않습니다. 이것은 나를 위해 일했습니다 :'cron = "30 0 0/1 * *?"'그리고 나는 왜 모른다. – user219882

0
<task:scheduled-tasks> 
<task:scheduled ref="pingProducer" method="producePingRequest" cron="0 0 0/1 * * ?" /> 
</task:scheduled-tasks> 

크론 =에 "0 0 0/1 * *?" 0/x는 0 시부 터 x시마다 실행되기 때문에 작동합니다.