Class AbstractJob

java.lang.Object
org.apache.ofbiz.service.job.AbstractJob
All Implemented Interfaces:
Serializable, Runnable, Job
Direct Known Subclasses:
GenericServiceJob, PurgeJob

public abstract class AbstractJob extends Object implements Job, Serializable
Abstract Job.
See Also:
  • Constructor Details

    • AbstractJob

      protected AbstractJob(String jobId, String jobName)
  • Method Details

    • getCurrentState

      public Job.State getCurrentState()
      Gets current state.
      Returns:
      the current state
    • setCurrentState

      public void setCurrentState(Job.State currentState)
      Sets current state.
      Parameters:
      currentState - the current state
    • currentState

      public Job.State currentState()
      Description copied from interface: Job
      Returns the current state of this job.
      Specified by:
      currentState in interface Job
    • getJobId

      public String getJobId()
      Description copied from interface: Job
      Returns the ID of this Job.
      Specified by:
      getJobId in interface Job
    • getJobName

      public String getJobName()
      Description copied from interface: Job
      Returns the name of this Job.
      Specified by:
      getJobName in interface Job
    • queue

      public void queue() throws InvalidJobException
      Description copied from interface: Job
      Transitions this job to the queued state.
      Specified by:
      queue in interface Job
      Throws:
      InvalidJobException
    • deQueue

      public void deQueue() throws InvalidJobException
      Description copied from interface: Job
      Transitions this job to the pre-queued (created) state. The job manager will call this method when there was a problem adding this job to the queue.
      Specified by:
      deQueue in interface Job
      Throws:
      InvalidJobException
    • exec

      public abstract void exec() throws InvalidJobException
      Executes this Job. The run() method calls this method.
      Throws:
      InvalidJobException
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • getRuntime

      public long getRuntime()
      Description copied from interface: Job
      Returns the job execution time in milliseconds. Returns zero if the job has not run.
      Specified by:
      getRuntime in interface Job
    • getStartTime

      public Date getStartTime()
      Description copied from interface: Job
      Returns the time this job is scheduled to start.
      Specified by:
      getStartTime in interface Job
    • getPriority

      public long getPriority()
      Description copied from interface: Job
      Returns the priority of this job, higher the number the higher the priority
      Specified by:
      getPriority in interface Job