Package org.alfresco.schedule
Class ScheduledJobLockExecuter
- java.lang.Object
-
- org.alfresco.schedule.ScheduledJobLockExecuter
-
public class ScheduledJobLockExecuter extends java.lang.ObjectThis class encapsulates theJobLockServiceusage in order to guarantee that a job is not executed simultaneously in more than one node in a cluster. After instantiated passing in constructorjobto be executed, as well as the name of the to be locked job and theJobLockService, 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 onContentStoreCleaner, extracting the generic locking code in order to be reused and avoid code duplication.- Since:
- 4.1.5
- Author:
- Rui Fernandes
-
-
Constructor Summary
Constructors Constructor Description ScheduledJobLockExecuter(JobLockService jobLockService, java.lang.String name, AbstractScheduledLockedJob job)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute(org.quartz.JobExecutionContext jobContext)It will execute thejobpassed on instantiation taking care of all cluster aware lockings.
-
-
-
Constructor Detail
-
ScheduledJobLockExecuter
public ScheduledJobLockExecuter(JobLockService jobLockService, java.lang.String name, AbstractScheduledLockedJob job)
- Parameters:
jobLockService- theJobLockServicename- the name of the job to be used for the lock registryjob- thejobto be executed
-
-
Method Detail
-
execute
public void execute(org.quartz.JobExecutionContext jobContext) throws org.quartz.JobExecutionExceptionIt will execute thejobpassed on instantiation taking care of all cluster aware lockings.- Parameters:
jobContext- the usual quartz job context- Throws:
org.quartz.JobExecutionException- thrown if the job fails to execute
-
-