Package org.apache.ofbiz.service.job
Class AbstractJob
- java.lang.Object
-
- org.apache.ofbiz.service.job.AbstractJob
-
- All Implemented Interfaces:
java.lang.Runnable
,Job
- Direct Known Subclasses:
GenericServiceJob
,PurgeJob
public abstract class AbstractJob extends java.lang.Object implements Job
Abstract Job.
-
-
Field Summary
Fields Modifier and Type Field Description protected Job.State
currentState
static java.lang.String
module
-
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.java.lang.String
getJobId()
Returns the ID of this Job.java.lang.String
getJobName()
Returns the name of this Job.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()
-
-
-
Field Detail
-
module
public static final java.lang.String module
-
currentState
protected Job.State currentState
-
-
Method Detail
-
currentState
public Job.State currentState()
Description copied from interface:Job
Returns the current state of this job.- Specified by:
currentState
in interfaceJob
-
getJobId
public java.lang.String getJobId()
Description copied from interface:Job
Returns the ID of this Job.
-
getJobName
public java.lang.String getJobName()
Description copied from interface:Job
Returns the name of this Job.- Specified by:
getJobName
in interfaceJob
-
queue
public void queue() throws InvalidJobException
Description copied from interface:Job
Transitions this job to the queued state.- Specified by:
queue
in interfaceJob
- 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 interfaceJob
- Throws:
InvalidJobException
-
exec
public abstract void exec() throws InvalidJobException
Executes this Job. Therun()
method calls this method.- Throws:
InvalidJobException
-
run
public void run()
- Specified by:
run
in interfacejava.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 interfaceJob
-
getStartTime
public java.util.Date getStartTime()
Description copied from interface:Job
Returns the time this job is scheduled to start.- Specified by:
getStartTime
in interfaceJob
-
-