Last change
on this file since 967 was
623,
checked in by gav, 14 years ago
|
Small adjustment to comments in TaskRecurringScheduleJob.groovy
|
File size:
1.5 KB
|
Rev | Line | |
---|
[199] | 1 | import org.codehaus.groovy.grails.commons.* |
---|
[123] | 2 | |
---|
[199] | 3 | /** |
---|
| 4 | * Provides a quartz job that reviews and generates all recurring tasks. |
---|
| 5 | * The quartz scheduler is restarted if this file is edited so startDelay will then delay again. |
---|
| 6 | * The execute method is called once every repeatInterval (in milliseconds). |
---|
[623] | 7 | * With concurrent=false the next job is blocked until the previous job completes. |
---|
[199] | 8 | * Apparently we need a hibernate session otherwise we get a LazyInitializationException, default is true but we specify it to be sure. |
---|
| 9 | */ |
---|
| 10 | class TaskRecurringScheduleJob { |
---|
[123] | 11 | |
---|
[199] | 12 | def taskRecurringScheduleService |
---|
| 13 | |
---|
| 14 | def concurrent = false |
---|
| 15 | def sessionRequired = true |
---|
| 16 | |
---|
[623] | 17 | // The repeatInterval starts counting again after firing, but concurrent = false may block firing until the previous job completes. |
---|
[199] | 18 | static triggers = { |
---|
| 19 | simple name: "GenerateAll", |
---|
| 20 | startDelay: 60000, |
---|
| 21 | repeatInterval: ConfigurationHolder.config.taskRecurringScheduleJob.repeatInterval*1000 |
---|
| 22 | } |
---|
| 23 | |
---|
[123] | 24 | def execute() { |
---|
| 25 | |
---|
[199] | 26 | // Some information can be accessed if we run with "def execute(context) ". |
---|
| 27 | // For more info see: http://quartz.sourceforge.net/javadoc/org/quartz/JobExecutionContext.html |
---|
| 28 | // log.debug context.getTrigger() |
---|
| 29 | // log.debug context.getPreviousFireTime() |
---|
| 30 | // log.debug context.getFireTime() |
---|
[123] | 31 | |
---|
[199] | 32 | // We do everything via services, quartz just sets up and fires off the thread. |
---|
| 33 | taskRecurringScheduleService.generateAll() |
---|
| 34 | } |
---|
[123] | 35 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.