public class ScheduledJobLockExecuter extends Object
JobLockService
usage in order to guarantee that a job is not executed
simultaneously in more than one node in a cluster. After instantiated passing
in constructor job
to be executed, as well as the name of the to be locked job and the
JobLockService
, the execute
method of this class will execute the job taking care of all cluster aware lockings.
This code is based on original code by Derek Hulley on
ContentStoreCleaner
,
extracting the generic locking code in order to be reused and avoid code duplication.Constructor and Description |
---|
ScheduledJobLockExecuter(JobLockService jobLockService,
String name,
AbstractScheduledLockedJob job) |
Modifier and Type | Method and Description |
---|---|
void |
execute(org.quartz.JobExecutionContext jobContext)
It will execute the
job passed on
instantiation taking care of all cluster aware lockings. |
public ScheduledJobLockExecuter(JobLockService jobLockService, String name, AbstractScheduledLockedJob job)
jobLockService
- the JobLockService
name
- the name of the job to be used for the lock registryjob
- the job
to be executedpublic void execute(org.quartz.JobExecutionContext jobContext) throws org.quartz.JobExecutionException
job
passed on
instantiation taking care of all cluster aware lockings.jobContext
- the usual quartz job contextorg.quartz.JobExecutionException
- thrown if the job fails to executeCopyright © 2005–2017 Alfresco Software. All rights reserved.