Changeset 622 for trunk/grails-app/jobs
- Timestamp:
- Jul 10, 2010, 10:48:50 PM (14 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/jobs/InventoryIndexJob.groovy
r620 r622 1 import org.codehaus.groovy.grails.commons. *1 import org.codehaus.groovy.grails.commons.ConfigurationHolder 2 2 3 3 /** 4 * Provides a quartz job that re index's the Lucene index for the Inventory domain class.5 * With concurrent=false the repeat interval starts afterthe previous job completes.4 * Provides a quartz job that rebuilds the searchable index for the inventory search. 5 * With concurrent=false the next job is blocked until the previous job completes. 6 6 * We need a hibernate session otherwise we get a LazyInitializationException, default is true but we specify it to be sure. 7 * Rebuilding the index is required since searchable components are not updated when they change, that is 8 * until the parent is updated and reindexed. Cascade update is broken in searchable-0.5.5 7 9 */ 8 class Inventory ReindexJob {10 class InventoryIndexJob { 9 11 10 12 def concurrent = false … … 16 18 // See: http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html 17 19 // Trigger every hour on the hour: 18 cron name: 'RebuildInventoryIndex', cronExpression: "0 0 * * * ?"20 //cron name: 'RebuildInventoryIndex', cronExpression: "0 0 * * * ?" 19 21 } 20 22 21 def execute( ) {23 def execute(context) { 22 24 23 25 // Some information can be accessed if we run with "def execute(context) ". … … 27 29 // log.debug context.getFireTime() 28 30 29 // Reindex the Inventory domain class. 30 log.info "Rebuilding Lucene index, Inventory.reindex()." 31 InventoryItem.reindex() 32 log.info "Rebuilding Lucene index, complete." 31 // Called by. 32 def calledBy = context.mergedJobDataMap.get('calledBy') 33 log.info "Called By: " + calledBy 34 35 // Rebuild the Inventory searchable index. 36 log.info "Calling, Inventory.index()." 37 InventoryItem.index() 33 38 } 34 39 }
Note: See TracChangeset
for help on using the changeset viewer.