Class JobExecutionContextImpl

java.lang.Object
org.quartz.core.JobExecutionContextImpl
All Implemented Interfaces:
Serializable, JobExecutionContext

public class JobExecutionContextImpl extends Object implements Serializable, JobExecutionContext
See Also:
  • Constructor Details

    • JobExecutionContextImpl

      public JobExecutionContextImpl(Scheduler scheduler, TriggerFiredBundle firedBundle, Job job)
      Create a JobExcecutionContext with the given context data.
  • Method Details

    • getScheduler

      public Scheduler getScheduler()
      Description copied from interface: JobExecutionContext
      Get a handle to the Scheduler instance that fired the Job.
      Specified by:
      getScheduler in interface JobExecutionContext
    • getTrigger

      public Trigger getTrigger()
      Description copied from interface: JobExecutionContext
      Get a handle to the Trigger instance that fired the Job.
      Specified by:
      getTrigger in interface JobExecutionContext
    • getCalendar

      public Calendar getCalendar()
      Description copied from interface: JobExecutionContext
      Get a handle to the Calendar referenced by the Trigger instance that fired the Job.
      Specified by:
      getCalendar in interface JobExecutionContext
    • isRecovering

      public boolean isRecovering()
      Description copied from interface: JobExecutionContext
      If the Job is being re-executed because of a 'recovery' situation, this method will return true.
      Specified by:
      isRecovering in interface JobExecutionContext
    • incrementRefireCount

      public void incrementRefireCount()
    • getRefireCount

      public int getRefireCount()
      Specified by:
      getRefireCount in interface JobExecutionContext
    • getMergedJobDataMap

      public JobDataMap getMergedJobDataMap()
      Description copied from interface: JobExecutionContext
      Get the convenience JobDataMap of this execution context.

      The JobDataMap found on this object serves as a convenience - it is a merge of the JobDataMap found on the JobDetail and the one found on the Trigger, with the value in the latter overriding any same-named values in the former. It is thus considered a 'best practice' that the execute code of a Job retrieve data from the JobDataMap found on this object.

      NOTE: Do not expect value 'set' into this JobDataMap to somehow be set back onto a StatefulJob's own JobDataMap.

      Attempts to change the contents of this map typically result in an IllegalStateException.

      Specified by:
      getMergedJobDataMap in interface JobExecutionContext
    • getJobDetail

      public JobDetail getJobDetail()
      Description copied from interface: JobExecutionContext
      Get the JobDetail associated with the Job.
      Specified by:
      getJobDetail in interface JobExecutionContext
    • getJobInstance

      public Job getJobInstance()
      Description copied from interface: JobExecutionContext
      Get the instance of the Job that was created for this execution.

      Note: The Job instance is not available through remote scheduler interfaces.

      Specified by:
      getJobInstance in interface JobExecutionContext
    • getFireTime

      public Date getFireTime()
      Description copied from interface: JobExecutionContext
      The actual time the trigger fired. For instance the scheduled time may have been 10:00:00 but the actual fire time may have been 10:00:03 if the scheduler was too busy.
      Specified by:
      getFireTime in interface JobExecutionContext
      Returns:
      Returns the fireTime.
      See Also:
    • getScheduledFireTime

      public Date getScheduledFireTime()
      Description copied from interface: JobExecutionContext
      The scheduled time the trigger fired for. For instance the scheduled time may have been 10:00:00 but the actual fire time may have been 10:00:03 if the scheduler was too busy.
      Specified by:
      getScheduledFireTime in interface JobExecutionContext
      Returns:
      Returns the scheduledFireTime.
      See Also:
    • getPreviousFireTime

      public Date getPreviousFireTime()
      Specified by:
      getPreviousFireTime in interface JobExecutionContext
    • getNextFireTime

      public Date getNextFireTime()
      Specified by:
      getNextFireTime in interface JobExecutionContext
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getResult

      public Object getResult()
      Description copied from interface: JobExecutionContext
      Returns the result (if any) that the Job set before its execution completed (the type of object set as the result is entirely up to the particular job).

      The result itself is meaningless to Quartz, but may be informative to JobListeners or TriggerListeners that are watching the job's execution.

      Specified by:
      getResult in interface JobExecutionContext
      Returns:
      Returns the result.
    • setResult

      public void setResult(Object result)
      Description copied from interface: JobExecutionContext
      Set the result (if any) of the Job's execution (the type of object set as the result is entirely up to the particular job).

      The result itself is meaningless to Quartz, but may be informative to JobListeners or TriggerListeners that are watching the job's execution.

      Specified by:
      setResult in interface JobExecutionContext
    • getJobRunTime

      public long getJobRunTime()
      Description copied from interface: JobExecutionContext
      The amount of time the job ran for (in milliseconds). The returned value will be -1 until the job has actually completed (or thrown an exception), and is therefore generally only useful to JobListeners and TriggerListeners.
      Specified by:
      getJobRunTime in interface JobExecutionContext
      Returns:
      Returns the jobRunTime.
    • setJobRunTime

      public void setJobRunTime(long jobRunTime)
      Parameters:
      jobRunTime - The jobRunTime to set.