Package com.avoka.fc.core.job
Class AbstractJob
- java.lang.Object
-
- com.avoka.fc.core.job.AbstractJob
-
-
Field Summary
Fields Modifier and Type Field Description static String
JOB_CONTEXT_PARAM
The Job execution context data map paramter name.static String
JOB_GROUP_BACKGROUND
The job group for background jobs that are not to be managed in the management consolestatic String
JOB_GROUP_MEMORY
The job group for in memory jobs that are not to be managed in the management consoleprotected boolean
logExecution
Log the job execution.protected static List
MANAGER_LISTENERS
static String
SERVLET_CONTEXT
The scheduler context path for the application servlet context.static String
SPRING_CONTEXT
The schedulder context path for the application servlet context.
-
Constructor Summary
Constructors Constructor Description AbstractJob()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
execute(org.quartz.JobExecutionContext context)
Called by the Scheduler when a Trigger fires that is associated with the Job.abstract void
executeJob()
Subclasses should override this method to provide their functionality.org.quartz.JobExecutionContext
getContext()
Return the Quartz JobExecutionContext.String
getContextParam()
Return the "JobContextParam" value configured for the Scheduled Job.org.apache.cayenne.access.DataContext
getDataContext()
Return the thread local DataContext.ErrorLogService
getErrorLogService()
org.slf4j.Logger
getLogger()
Return the object logger.ServletContext
getServletContext()
Return the application servlet context.void
interrupt()
Called by the Scheduler when a user interrupts the job.boolean
isInterrupted()
Return true if the job has been manually stopped.ErrorLog
logException(Throwable error)
Log the exception to the ErrorLog if an error occurs performing the job.
-
-
-
Field Detail
-
SPRING_CONTEXT
public static final String SPRING_CONTEXT
The schedulder context path for the application servlet context.- See Also:
- Constant Field Values
-
SERVLET_CONTEXT
public static final String SERVLET_CONTEXT
The scheduler context path for the application servlet context.- See Also:
- Constant Field Values
-
JOB_CONTEXT_PARAM
public static final String JOB_CONTEXT_PARAM
The Job execution context data map paramter name.- See Also:
- Constant Field Values
-
JOB_GROUP_BACKGROUND
public static final String JOB_GROUP_BACKGROUND
The job group for background jobs that are not to be managed in the management console- See Also:
- Constant Field Values
-
JOB_GROUP_MEMORY
public static final String JOB_GROUP_MEMORY
The job group for in memory jobs that are not to be managed in the management console- See Also:
- Constant Field Values
-
MANAGER_LISTENERS
protected static final List MANAGER_LISTENERS
-
logExecution
protected boolean logExecution
Log the job execution.
-
-
Method Detail
-
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
public String 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.UnableToInterruptJobException
Called 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
public ErrorLogService 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 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:
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)
-
-