Class AbstractScheduledLockedJob

  • All Implemented Interfaces:
    org.quartz.Job

    public abstract class AbstractScheduledLockedJob
    extends org.springframework.scheduling.quartz.QuartzJobBean
    This class should be extended any time a scheduled job needs to be implemented to be executed using JobLockService. It makes the cluster aware locking of the job transparent to the implementation. On the job's spring JobExecutionContext it will still always have to be passed as parameter the jobLockService. The name to be used for locking of the job is optional, if none is passed a name will be composed using the simple name of the implementation class. In general if it may make sense to have more than one job setup using the same class you should always use a different name on each JobExecutionContext to differentiate the jobs, unless you want the lock to be shared between the different instances.

    The only method to be implemented when extending this class is executeJob(JobExecutionContext).

    Since:
    4.1.5
    Author:
    Rui Fernandes
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void executeInternal​(org.quartz.JobExecutionContext jobContext)  
      abstract void executeJob​(org.quartz.JobExecutionContext jobContext)
      This is the method that should be implemented by any extension of the abstract class.
      • Methods inherited from class org.springframework.scheduling.quartz.QuartzJobBean

        execute
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractScheduledLockedJob

        public AbstractScheduledLockedJob()
    • Method Detail

      • executeInternal

        protected final void executeInternal​(org.quartz.JobExecutionContext jobContext)
                                      throws org.quartz.JobExecutionException
        Specified by:
        executeInternal in class org.springframework.scheduling.quartz.QuartzJobBean
        Throws:
        org.quartz.JobExecutionException
      • executeJob

        public abstract void executeJob​(org.quartz.JobExecutionContext jobContext)
                                 throws org.quartz.JobExecutionException
        This is the method that should be implemented by any extension of the abstract class. It won't need to worry about any lockings of the job and can focus only on its specific task.
        Parameters:
        jobContext - context of the execution for retrieving services, etc
        Throws:
        org.quartz.JobExecutionException - if a job fails to execute