I am trying to configure cron to work in my Grails web application using the Quartz plugin . Currently, I'm just trying to run a test job once per second using the following code:
class TestJob {
private int counter = 0
static triggers = {
simple repeatInterval: 1000
}
def execute() {
counter += 1
System.out.println("Testing the cron " + counter)
}
}
However, when I launch the application, I see only the first output of the first call execute()twice: once before I am notified that the server is working, and once immediately after.
| 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
Does anyone know why my quartet performance may not work correctly? I tried using cron instead of simple, as well as using various parameters, time intervals, etc. Nothing has changed the situation.
thank
source
share