source: branches/features/taskProcedureRework/grails-app/jobs/TaskRecurringScheduleJob.groovy @ 785

Last change on this file since 785 was 623, checked in by gav, 14 years ago

Small adjustment to comments in TaskRecurringScheduleJob.groovy

File size: 1.5 KB
Line 
1import org.codehaus.groovy.grails.commons.*
2
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).
7* With concurrent=false the next job is blocked until the previous job completes.
8* Apparently we need a hibernate session otherwise we get a LazyInitializationException, default is true but we specify it to be sure.
9*/
10class TaskRecurringScheduleJob {
11
12    def taskRecurringScheduleService
13
14    def concurrent = false
15    def sessionRequired = true
16
17    // The repeatInterval starts counting again after firing, but concurrent = false may block firing until the previous job completes.
18    static triggers = {
19        simple name: "GenerateAll",
20                    startDelay: 60000,
21                    repeatInterval: ConfigurationHolder.config.taskRecurringScheduleJob.repeatInterval*1000
22    }
23
24    def execute() {
25
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()
31
32        // We do everything via services, quartz just sets up and fires off the thread.
33        taskRecurringScheduleService.generateAll()
34    }
35}
Note: See TracBrowser for help on using the repository browser.