Package com.helger.web.scope.util
Class AbstractScopeAwareJob
- java.lang.Object
-
- com.helger.schedule.job.AbstractJob
-
- com.helger.web.scope.util.AbstractScopeAwareJob
-
- All Implemented Interfaces:
com.helger.quartz.IJob
@ThreadSafe public abstract class AbstractScopeAwareJob extends com.helger.schedule.job.AbstractJobAbstractIJobimplementation that handles request scopes correctly. This is required, because each scheduled job runs in its own thread so that no defaultScopeManagerinformation would be available.- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description AbstractScopeAwareJob()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterExecute(com.helger.quartz.JobDataMap aJobDataMap, com.helger.quartz.IJobExecutionContext aContext, com.helger.commons.state.ESuccess eExecSuccess)protected voidafterExecuteInScope(com.helger.quartz.JobDataMap aJobDataMap, com.helger.quartz.IJobExecutionContext aContext, com.helger.commons.state.ESuccess eExecSuccess)Called after the job gets executed.protected voidbeforeExecute(com.helger.quartz.JobDataMap aJobDataMap, com.helger.quartz.IJobExecutionContext aContext)protected voidbeforeExecuteInScope(com.helger.quartz.JobDataMap aJobDataMap, com.helger.quartz.IJobExecutionContext aContext)Called before the job gets executed.protected com.helger.servlet.mock.MockHttpServletRequestcreateMockHttpServletRequest()protected com.helger.servlet.mock.MockHttpServletResponsecreateMockHttpServletResponse()
-
-
-
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
OfflineHttpServletRequestis 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
MockHttpServletResponseis 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. Nevernull.aContext- The current job execution context. Nevernull.
-
beforeExecute
@OverrideOnDemand @OverridingMethodsMustInvokeSuper protected void beforeExecute(@Nonnull com.helger.quartz.JobDataMap aJobDataMap, @Nonnull com.helger.quartz.IJobExecutionContext aContext)
- Overrides:
beforeExecutein classcom.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. Nevernull.aContext- The current job execution context. Nevernull.eExecSuccess- The execution success state. Nevernull.
-
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:
afterExecutein classcom.helger.schedule.job.AbstractJob
-
-