Package org.apache.ofbiz.service.job
Class GenericServiceJob
java.lang.Object
org.apache.ofbiz.service.job.AbstractJob
org.apache.ofbiz.service.job.GenericServiceJob
- All Implemented Interfaces:
Serializable
,Runnable
,Job
- Direct Known Subclasses:
PersistedServiceJob
A generic async-service job.
- See Also:
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionGenericServiceJob
(DispatchContext dctx, String jobId, String jobName, String service, Map<String, Object> context, GenericRequester req) -
Method Summary
Modifier and TypeMethodDescriptionvoid
deQueue()
Transitions this job to the pre-queued (created) state.void
exec()
Invokes the service.protected void
Method is called when the service fails.protected void
Method is called after the service has finished successfully.Gets the context for the service invocation.getDctx()
Gets dctx.protected String
Gets the name of the service as defined in the definition file.protected void
init()
Method is called prior to running the service.boolean
isValid()
Returns true if this job is ready to be queued.Methods inherited from class org.apache.ofbiz.service.job.AbstractJob
currentState, getCurrentState, getJobId, getJobName, getPriority, getRuntime, getStartTime, queue, run, setCurrentState
-
Constructor Details
-
GenericServiceJob
public GenericServiceJob(DispatchContext dctx, String jobId, String jobName, String service, Map<String, Object> context, GenericRequester req)
-
-
Method Details
-
getDctx
Gets dctx.- Returns:
- the dctx
-
exec
Invokes the service.- Specified by:
exec
in classAbstractJob
- Throws:
InvalidJobException
-
init
Method is called prior to running the service.- Throws:
InvalidJobException
-
finish
Method is called after the service has finished successfully.- Throws:
InvalidJobException
-
failed
Method is called when the service fails.- Parameters:
t
- Throwable- Throws:
InvalidJobException
-
getContext
Gets the context for the service invocation.- Returns:
- Map of name value pairs making up the service context.
- Throws:
InvalidJobException
-
getServiceName
Gets the name of the service as defined in the definition file.- Returns:
- The name of the service to be invoked.
-
isValid
public boolean isValid()Description copied from interface:Job
Returns true if this job is ready to be queued. -
deQueue
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 classAbstractJob
- Throws:
InvalidJobException
-