Class GenericServiceJob

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

    public class GenericServiceJob
    extends AbstractJob
    implements java.io.Serializable
    A generic async-service 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 
      Constructor Description
      GenericServiceJob​(DispatchContext dctx, java.lang.String jobId, java.lang.String jobName, java.lang.String service, java.util.Map<java.lang.String,​java.lang.Object> context, GenericRequester req)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void deQueue()
      Transitions this job to the pre-queued (created) state.
      void exec()
      Invokes the service.
      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.
      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 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • module

        public static final java.lang.String module
    • Constructor Detail

      • GenericServiceJob

        public GenericServiceJob​(DispatchContext dctx,
                                 java.lang.String jobId,
                                 java.lang.String jobName,
                                 java.lang.String service,
                                 java.util.Map<java.lang.String,​java.lang.Object> context,
                                 GenericRequester req)
    • Method Detail

      • finish

        protected void finish​(java.util.Map<java.lang.String,​java.lang.Object> result)
                       throws InvalidJobException
        Method is called after the service has finished successfully.
        Throws:
        InvalidJobException
      • getContext

        protected java.util.Map<java.lang.String,​java.lang.Object> getContext()
                                                                             throws InvalidJobException
        Gets the context for the service invocation.
        Returns:
        Map of name value pairs making up the service context.
        Throws:
        InvalidJobException
      • getServiceName

        protected java.lang.String 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.
        Specified by:
        isValid 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
        Overrides:
        deQueue in class AbstractJob
        Throws:
        InvalidJobException