Class AbstractJob

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Runnable, Job
    Direct Known Subclasses:
    GenericServiceJob, PurgeJob

    public abstract class AbstractJob
    extends java.lang.Object
    implements Job, java.io.Serializable
    Abstract Job.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.apache.ofbiz.service.job.Job

        Job.State
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractJob​(java.lang.String jobId, java.lang.String jobName)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      Job.State currentState()
      Returns the current state of this job.
      void deQueue()
      Transitions this job to the pre-queued (created) state.
      abstract void exec()
      Executes this Job.
      Job.State getCurrentState()
      Gets current state.
      java.lang.String getJobId()
      Returns the ID of this Job.
      java.lang.String getJobName()
      Returns the name of this Job.
      long getPriority()
      Returns the priority of this job, higher the number the higher the priority
      long getRuntime()
      Returns the job execution time in milliseconds.
      java.util.Date getStartTime()
      Returns the time this job is scheduled to start.
      void queue()
      Transitions this job to the queued state.
      void run()  
      void setCurrentState​(Job.State currentState)
      Sets current state.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apache.ofbiz.service.job.Job

        isValid
    • Constructor Detail

      • AbstractJob

        protected AbstractJob​(java.lang.String jobId,
                              java.lang.String jobName)
    • Method Detail

      • 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 java.lang.String getJobId()
        Description copied from interface: Job
        Returns the ID of this Job.
        Specified by:
        getJobId in interface Job
      • getJobName

        public java.lang.String getJobName()
        Description copied from interface: Job
        Returns the name of this Job.
        Specified by:
        getJobName in interface Job
      • 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
      • run

        public void run()
        Specified by:
        run in interface java.lang.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 java.util.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