Package com.avoka.fc.core.job
Class AbstractJob
java.lang.Object
com.avoka.fc.core.job.AbstractJob
- All Implemented Interfaces:
org.quartz.InterruptableJob,org.quartz.Job
- Direct Known Subclasses:
BaseJob
public abstract class AbstractJob
extends Object
implements org.quartz.Job, org.quartz.InterruptableJob
Provides an abstract Quartz Job class.
- Since:
- 4.3.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe Job execution context data map paramter name.static final StringThe job group for background jobs that are not to be managed in the management consolestatic final StringThe job group for in memory jobs that are not to be managed in the management consoleprotected booleanLog the job execution.protected static final Liststatic final StringThe scheduler context path for the application servlet context.static final StringThe schedulder context path for the application servlet context. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.cayenne.access.DataContextCreate and bind DataContext with configuration used by AbstractJob classes.final voidexecute(org.quartz.JobExecutionContext context) Called by the Scheduler when a Trigger fires that is associated with the Job.abstract voidSubclasses should override this method to provide their functionality.org.quartz.JobExecutionContextReturn the Quartz JobExecutionContext.Return the "JobContextParam" value configured for the Scheduled Job.org.apache.cayenne.access.DataContextReturn the thread local DataContext.org.slf4j.LoggerReturn the object logger.jakarta.servlet.ServletContextReturn the application servlet context.voidCalled by the Scheduler when a user interrupts the job.booleanReturn true if the job has been manually stopped.logException(Throwable error) Log the exception to the ErrorLog if an error occurs performing the job.
-
Field Details
-
SPRING_CONTEXT
The schedulder context path for the application servlet context.- See Also:
-
SERVLET_CONTEXT
The scheduler context path for the application servlet context.- See Also:
-
JOB_CONTEXT_PARAM
The Job execution context data map paramter name.- See Also:
-
JOB_GROUP_BACKGROUND
The job group for background jobs that are not to be managed in the management console- See Also:
-
JOB_GROUP_MEMORY
The job group for in memory jobs that are not to be managed in the management console- See Also:
-
MANAGER_LISTENERS
-
logExecution
protected boolean logExecutionLog the job execution.
-
-
Constructor Details
-
AbstractJob
public AbstractJob()
-
-
Method Details
-
executeJob
public abstract void executeJob()Subclasses should override this method to provide their functionality. A DataContext object will be bound to the thread executing this task. Any uncommitted changes to the DataContext will be automatically rolled back when this method completes. -
getContext
public org.quartz.JobExecutionContext getContext()Return the Quartz JobExecutionContext.- Returns:
- the Quartz JobExecutionContext
-
getContextParam
Return the "JobContextParam" value configured for the Scheduled Job.- Returns:
- the "JobContextParam" value configured for the Scheduled Job.
-
getDataContext
public org.apache.cayenne.access.DataContext getDataContext()Return the thread local DataContext.- Returns:
- the thread local DataContext
-
isInterrupted
public boolean isInterrupted()Return true if the job has been manually stopped.- Returns:
- true if the job has been manually stopped
-
interrupt
public void interrupt() throws org.quartz.UnableToInterruptJobExceptionCalled by the Scheduler when a user interrupts the job.- Specified by:
interruptin interfaceorg.quartz.InterruptableJob- Throws:
org.quartz.UnableToInterruptJobException- if there is an exception while interrupting the job.- See Also:
-
getErrorLogService
- Returns:
- the error log service.
- Since:
- 4.3.4
-
getLogger
public org.slf4j.Logger getLogger()Return the object logger.- Returns:
- the object logger
-
getServletContext
public jakarta.servlet.ServletContext getServletContext()Return the application servlet context.- Returns:
- the application servlet context
-
execute
public final void execute(org.quartz.JobExecutionContext context) throws org.quartz.JobExecutionException Called by the Scheduler when a Trigger fires that is associated with the Job.- Specified by:
executein interfaceorg.quartz.Job- Parameters:
context- the job execute context- Throws:
org.quartz.JobExecutionException- if there is an exception while executing the job.- See Also:
-
logException
Log the exception to the ErrorLog if an error occurs performing the job. Subclasses can override this method to provide customized error logging behavior.- Parameters:
error- the exception to log (required)- Returns:
- the new ErrorLog record
-
createAndBindDataContext
public static org.apache.cayenne.access.DataContext createAndBindDataContext()Create and bind DataContext with configuration used by AbstractJob classes.- Since:
- 21.5.4
-