Package com.helger.schedule.job
Class AbstractJob
- java.lang.Object
-
- com.helger.schedule.job.AbstractJob
-
- All Implemented Interfaces:
com.helger.quartz.IJob
@ThreadSafe public abstract class AbstractJob extends Object implements com.helger.quartz.IJob
AbstractIJobimplementation with an exception handler etc.- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description AbstractJob()
-
Method Summary
All Methods Static Methods Instance Methods Abstract 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)Called after the job gets executed.protected voidbeforeExecute(com.helger.quartz.JobDataMap aJobDataMap, com.helger.quartz.IJobExecutionContext aContext)Called before the job gets executed.static com.helger.commons.callback.CallbackList<IJobExceptionCallback>exceptionCallbacks()voidexecute(com.helger.quartz.IJobExecutionContext aContext)protected abstract voidonExecute(com.helger.quartz.JobDataMap aJobDataMap, com.helger.quartz.IJobExecutionContext aContext)This is the method with the main actions to be executed.protected static voidtriggerCustomExceptionHandler(Throwable t, String sJobClassName, com.helger.quartz.IJob aJob)Called when an exception of the specified type occurred
-
-
-
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. Nevernull. The map might be modified inside of this method.aContext- The current job execution context. Nevernull.
-
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. Nevernull.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. Nevernull.aContext- The current job execution context. Nevernull.eExecSuccess- The execution success state. Nevernull.
-
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. Nevernull.sJobClassName- The name of the job classaJob- TheIJobinstance
-
execute
public final void execute(@Nonnull com.helger.quartz.IJobExecutionContext aContext) throws com.helger.quartz.JobExecutionException
- Specified by:
executein interfacecom.helger.quartz.IJob- Throws:
com.helger.quartz.JobExecutionException
-
-