2012-10-16 7 views
0

Quartz Job이 Grails에서 예상대로 동시에 실행되는 데 문제가 있습니다. 내 일은 다음과 같습니다. Executor 플러그인을 사용하는 줄을 주석 처리했지만 주석을 제거하지 않으면 코드가 예상대로 작동합니다. 내 경우 Grails Quartz Plugin concurrent가 작동하지 않습니다.

import java.util.concurrent.Callable 

import org.codehaus.groovy.grails.commons.ConfigurationHolder 

class PollerJob { 

    def concurrent = true 
    def myService1 
    def myService2 
    //def executorService 

    static triggers = { 
     cron name: 'pollerTrigger', startDelay:0, cronExpression: ConfigurationHolder.config.poller.cronExpression 
    } 

    def execute() { 
     def config = ConfigurationHolder.config 
     //Session session = null; 
     if (config.runPoller == true) { 
      //def result = executorService.submit({ 
       myService1.doStuff() 
       myService2.doOtherStuff() 
      //} as Callable) 
     } 
    } 

} 

의 myService2.doOtherStuff()이 작업을 트리거해야 다음 번 겹치는 완료하는 데 시간이 오래 걸립니다. 나는 그들이 왜 동시 적으로 def concurrent = true를 추가했는지 왜 겹치는 지 신경 쓰지 않지만 작동하지 않습니다.

버전 0.4.2의 Quartz 플러그인과 Grails 1.3.7이 있습니다. 내가 여기서 뭔가 잘못하고있는거야? 사용하기에 아주 간단한 기능처럼 보입니다. 나는 Executor 플러그인을 사용하는 것에 반대하지 않지만 그렇게해서는 안되는 것처럼 보인다.

나는이 문제에서 config에서로드하는 cronExpression이이 작업을 매분마다 실행하도록되어 있습니다. "0 * * * *?"

답변

1

분명히 숨겨진 설정이 있는데,이 기능이 작동하지 않는다는 사실을 알지 못했습니다. 내 conf 폴더에있는 파일은 다음과 같은 속성을 포함 quartz.properties라는 있었다 :

org.quartz.threadPool.threadCount = 1

후가 완료되지했을 때이 수를 증가, 내 직업도 유발했다 이전 실행.