Class StartJob

All Implemented Interfaces:
Serializable, Runnable, ArooaContextAware, ArooaSessionAware, Forceable, PropertyChangeNotifier, Iconic, LogEnabled, Resettable, Stateful

public class StartJob extends SerializableJob
Author:
Rob Gordon
See Also:

Description

This job will run another job. It is intended for starting services or jobs on remote servers which is why it is named start. If it used on a local job it will block until the local job has run.

Unlike the RunJob, this job will not monitor or reflect the state of the started job. To monitor the state of the started job the job could be followed by a MirrorState.

The start job won't reset the job to be started. If the job to start isn't started because it's in the wrong state this job will still COMPLETE. This job can be preceded by a ResetJob if resetting is required.

Example

Starting a service. A folder contains a choice of services. The service id to use is provided at runtime with a property such as -DpriceService=nonCachingPriceService. The selected service is started and used by the Pricing Job.
<oddjob>

  <job>

    <sequential>

      <jobs>

        <folder name="services">

          <jobs>

            <bean id="cachingPriceService" class="org.oddjob.examples.CachingPriceService"/>

            <bean id="nonCachingPriceService" class="org.oddjob.examples.NonCachingPriceService"/>

          </jobs>

        </folder>

        <start job="${${priceService}}"/>

        <bean id="pricingJob" class="org.oddjob.examples.PricingJob" priceService="${${priceService}}"/>

      </jobs>

    </sequential>

  </job>

</oddjob>
  • Constructor Details

    • StartJob

      public StartJob()
  • Method Details

    • setJob

      public void setJob(Runnable node)
      Set the stop node directly.
      Parameters:
      node - The job.
    • getJob

      public Runnable getJob()
      Get the job.
      Returns:
      The node.
    • execute

      protected int execute() throws Exception
      Description copied from class: SimpleJob
      Execute this job.
      Specified by:
      execute in class SimpleJob
      Returns:
      0 if the job is complete, anything else otherwise.
      Throws:
      Exception - If the unexpected occurs.