Class AbstractScopeAwareJob

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

    @ThreadSafe
    public abstract class AbstractScopeAwareJob
    extends com.helger.schedule.job.AbstractJob
    Abstract IJob implementation that handles request scopes correctly. This is required, because each scheduled job runs in its own thread so that no default ScopeManager information would be available.
    Author:
    Philip Helger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void afterExecute​(com.helger.quartz.JobDataMap aJobDataMap, com.helger.quartz.IJobExecutionContext aContext, com.helger.commons.state.ESuccess eExecSuccess)  
      protected void afterExecuteInScope​(com.helger.quartz.JobDataMap aJobDataMap, com.helger.quartz.IJobExecutionContext aContext, com.helger.commons.state.ESuccess eExecSuccess)
      Called after the job gets executed.
      protected void beforeExecute​(com.helger.quartz.JobDataMap aJobDataMap, com.helger.quartz.IJobExecutionContext aContext)  
      protected void beforeExecuteInScope​(com.helger.quartz.JobDataMap aJobDataMap, com.helger.quartz.IJobExecutionContext aContext)
      Called before the job gets executed.
      protected com.helger.servlet.mock.MockHttpServletRequest createMockHttpServletRequest()  
      protected com.helger.servlet.mock.MockHttpServletResponse createMockHttpServletResponse()  
      • Methods inherited from class com.helger.schedule.job.AbstractJob

        exceptionCallbacks, execute, onExecute, triggerCustomExceptionHandler
    • Constructor Detail

      • AbstractScopeAwareJob

        public AbstractScopeAwareJob()
    • Method Detail

      • createMockHttpServletRequest

        @Nonnull
        @OverrideOnDemand
        protected com.helger.servlet.mock.MockHttpServletRequest createMockHttpServletRequest()
        Returns:
        The dummy HTTP request to be used for executing this job. By default an OfflineHttpServletRequest is created.
      • createMockHttpServletResponse

        @Nonnull
        @OverrideOnDemand
        protected com.helger.servlet.mock.MockHttpServletResponse createMockHttpServletResponse()
        Returns:
        The dummy HTTP response to be used for executing this job. By default a MockHttpServletResponse is created.
      • beforeExecuteInScope

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

        @OverrideOnDemand
        @OverridingMethodsMustInvokeSuper
        protected void beforeExecute​(@Nonnull
                                     com.helger.quartz.JobDataMap aJobDataMap,
                                     @Nonnull
                                     com.helger.quartz.IJobExecutionContext aContext)
        Overrides:
        beforeExecute in class com.helger.schedule.job.AbstractJob
      • afterExecuteInScope

        @OverrideOnDemand
        protected void afterExecuteInScope​(@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 before 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.
      • afterExecute

        @OverrideOnDemand
        @OverridingMethodsMustInvokeSuper
        protected void afterExecute​(@Nonnull
                                    com.helger.quartz.JobDataMap aJobDataMap,
                                    @Nonnull
                                    com.helger.quartz.IJobExecutionContext aContext,
                                    @Nonnull
                                    com.helger.commons.state.ESuccess eExecSuccess)
        Overrides:
        afterExecute in class com.helger.schedule.job.AbstractJob