Grails的Quartz作业只会触发一次

Mik*_*uto 5 grails quartz-scheduler

我正在尝试使用Quartz插件在我的Grails Web应用程序中设置一个cron作业.我目前只是尝试使用以下代码每秒执行一次测试作业:

class TestJob {
    private int counter = 0
    static triggers = {
        simple repeatInterval: 1000
    }

    def execute() {
        // execute job
        counter += 1
        System.out.println("Testing the cron " + counter)
    }
}
Run Code Online (Sandbox Code Playgroud)

但是,当我运行应用程序时,我只看到第一次execute()调用的初始输出两次:一次是在我收到服务器正在运行的警报之前,一次是在紧接着之后.

| Loading Grails 2.1.0
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application.....
| Compiling 1 source files.....
| Running Grails application
Testing the cron 1
| Server running. Browse to http://localhost:8080/QuartzTest
Testing the cron 1
Run Code Online (Sandbox Code Playgroud)

有谁知道为什么我的Quartz作业可能无法正确触发?我尝试过使用cron而不是简单,以及使用不同的参数,时间间隔等.没有什么有所作为.

谢谢

Chr*_*ris 12

我想我有类似的问题.你不能System.out.println在石英工作中使用.尝试使用log.error.