Class AbstractJob

  • All Implemented Interfaces:
    com.helger.quartz.IJob

    @ThreadSafe
    public abstract class AbstractJob
    extends Object
    implements com.helger.quartz.IJob
    Abstract IJob implementation with an exception handler etc.
    Author:
    Philip Helger
    • Constructor Detail

      • AbstractJob

        public AbstractJob()
    • Method Detail

      • exceptionCallbacks

        @Nonnull
        @ReturnsMutableObject
        public static com.helger.commons.callback.CallbackList<IJobExceptionCallback> exceptionCallbacks()
        Returns:
        The custom exception handler. Never null.
      • beforeExecute

        @OverrideOnDemand
        protected void beforeExecute​(@Nonnull
                                     com.helger.quartz.JobDataMap aJobDataMap,
                                     @Nonnull
                                     com.helger.quartz.IJobExecutionContext aContext)
        Called before the job gets executed. This method is called before the scopes are initialized!
        Parameters:
        aJobDataMap - The current job data map. Never null. The map might be modified inside of this method.
        aContext - The current job execution context. Never null.
      • onExecute

        @OverrideOnDemand
        protected abstract void onExecute​(@Nonnull
                                          com.helger.quartz.JobDataMap aJobDataMap,
                                          @Nonnull
                                          com.helger.quartz.IJobExecutionContext aContext)
                                   throws com.helger.quartz.JobExecutionException
        This is the method with the main actions to be executed.
        Parameters:
        aJobDataMap - The current job data map. Never null.
        aContext - The Quartz context
        Throws:
        com.helger.quartz.JobExecutionException - In case of an error in execution
      • afterExecute

        @OverrideOnDemand
        protected void afterExecute​(@Nonnull
                                    com.helger.quartz.JobDataMap aJobDataMap,
                                    @Nonnull
                                    com.helger.quartz.IJobExecutionContext aContext,
                                    @Nonnull
                                    com.helger.commons.state.ESuccess eExecSuccess)
        Called after the job gets executed. This method is called after the scopes are destroyed.
        Parameters:
        aJobDataMap - The current job data map. Never null.
        aContext - The current job execution context. Never null.
        eExecSuccess - The execution success state. Never null.
      • triggerCustomExceptionHandler

        protected static void triggerCustomExceptionHandler​(@Nonnull
                                                            Throwable t,
                                                            @Nullable
                                                            String sJobClassName,
                                                            @Nonnull
                                                            com.helger.quartz.IJob aJob)
        Called when an exception of the specified type occurred
        Parameters:
        t - The exception. Never null.
        sJobClassName - The name of the job class
        aJob - The IJob instance
      • execute

        public final void execute​(@Nonnull
                                  com.helger.quartz.IJobExecutionContext aContext)
                           throws com.helger.quartz.JobExecutionException
        Specified by:
        execute in interface com.helger.quartz.IJob
        Throws:
        com.helger.quartz.JobExecutionException