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
Modifier and TypeFieldDescriptionstatic final String
The Job execution context data map paramter name.static final String
The job group for background jobs that are not to be managed in the management consolestatic final String
The job group for in memory jobs that are not to be managed in the management consoleprotected boolean
Log the job execution.protected static final List
static final String
The scheduler context path for the application servlet context.static final String
The schedulder context path for the application servlet context. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
execute
(org.quartz.JobExecutionContext context) Called by the Scheduler when a Trigger fires that is associated with the Job.abstract void
Subclasses should override this method to provide their functionality.org.quartz.JobExecutionContext
Return the Quartz JobExecutionContext.Return the "JobContextParam" value configured for the Scheduled Job.org.apache.cayenne.access.DataContext
Return the thread local DataContext.org.slf4j.Logger
Return the object logger.Return the application servlet context.void
Called by the Scheduler when a user interrupts the job.boolean
Return 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:
interrupt
in interfaceorg.quartz.InterruptableJob
- Throws:
org.quartz.UnableToInterruptJobException
- if there is an exception while interrupting the job.- See Also:
-
InterruptableJob.interrupt()
-
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
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:
execute
in interfaceorg.quartz.Job
- Parameters:
context
- the job execute context- Throws:
org.quartz.JobExecutionException
- if there is an exception while executing the job.- See Also:
-
Job.execute(JobExecutionContext)
-
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
-