Package org.apache.ofbiz.service.job
Class PersistedServiceJob
- java.lang.Object
-
- org.apache.ofbiz.service.job.AbstractJob
-
- org.apache.ofbiz.service.job.GenericServiceJob
-
- org.apache.ofbiz.service.job.PersistedServiceJob
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Runnable
,Job
public class PersistedServiceJob extends GenericServiceJob
AJob
that is backed by the entity engine. Job data is stored in the JobSandbox entity.When the job is queued, this object "owns" the entity value. Any external changes are ignored except the cancelDateTime field - jobs can be canceled after they are queued.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
module
-
Fields inherited from class org.apache.ofbiz.service.job.GenericServiceJob
dctx, requester
-
Fields inherited from class org.apache.ofbiz.service.job.AbstractJob
currentState
-
-
Constructor Summary
Constructors Constructor Description PersistedServiceJob(DispatchContext dctx, GenericValue jobValue, GenericRequester req)
Creates a new PersistedServiceJob
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deQueue()
Transitions this job to the pre-queued (created) state.protected void
failed(java.lang.Throwable t)
Method is called when the service fails.protected void
finish(java.util.Map<java.lang.String,java.lang.Object> result)
Method is called after the service has finished successfully.protected java.util.Map<java.lang.String,java.lang.Object>
getContext()
Gets the context for the service invocation.protected java.lang.String
getServiceName()
Gets the name of the service as defined in the definition file.java.util.Date
getStartTime()
Returns the time this job is scheduled to start.protected void
init()
Method is called prior to running the service.void
queue()
Transitions this job to the queued state.-
Methods inherited from class org.apache.ofbiz.service.job.GenericServiceJob
exec, isValid
-
Methods inherited from class org.apache.ofbiz.service.job.AbstractJob
currentState, getJobId, getJobName, getRuntime, run
-
-
-
-
Constructor Detail
-
PersistedServiceJob
public PersistedServiceJob(DispatchContext dctx, GenericValue jobValue, GenericRequester req)
Creates a new PersistedServiceJob- Parameters:
dctx
-jobValue
-req
-
-
-
Method Detail
-
queue
public void queue() throws InvalidJobException
Description copied from interface:Job
Transitions this job to the queued state.- Specified by:
queue
in interfaceJob
- Overrides:
queue
in classAbstractJob
- Throws:
InvalidJobException
-
init
protected void init() throws InvalidJobException
Description copied from class:GenericServiceJob
Method is called prior to running the service.- Overrides:
init
in classGenericServiceJob
- Throws:
InvalidJobException
-
finish
protected void finish(java.util.Map<java.lang.String,java.lang.Object> result) throws InvalidJobException
Description copied from class:GenericServiceJob
Method is called after the service has finished successfully.- Overrides:
finish
in classGenericServiceJob
- Throws:
InvalidJobException
-
failed
protected void failed(java.lang.Throwable t) throws InvalidJobException
Description copied from class:GenericServiceJob
Method is called when the service fails.- Overrides:
failed
in classGenericServiceJob
- Parameters:
t
- Throwable- Throws:
InvalidJobException
-
getServiceName
protected java.lang.String getServiceName()
Description copied from class:GenericServiceJob
Gets the name of the service as defined in the definition file.- Overrides:
getServiceName
in classGenericServiceJob
- Returns:
- The name of the service to be invoked.
-
getContext
protected java.util.Map<java.lang.String,java.lang.Object> getContext() throws InvalidJobException
Description copied from class:GenericServiceJob
Gets the context for the service invocation.- Overrides:
getContext
in classGenericServiceJob
- Returns:
- Map of name value pairs making up the service context.
- 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
- Overrides:
deQueue
in classGenericServiceJob
- Throws:
InvalidJobException
-
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
- Overrides:
getStartTime
in classAbstractJob
-
-