Class StopJob

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

public class StopJob extends SerializableJob implements Stoppable
Author:
Rob Gordon
See Also:

Description

A job which stops another job.

Normally The stop job will not complete until the job it is stopping is in a stopped state, however if the stop job is attempting tos stop a parent of itself (and therefore itself) then this stop job will detect this and stop. It will therefore complete even if thing it is trying to stop hasn't fully stopped.

Example

Examples elsewhere.
  • JMXClientJob has an example where the stop job is used to stop a client once the connection is no longer needed.
  • Field Details

    • RESULT_POLL_TIMEOUT

      public static final int RESULT_POLL_TIMEOUT
      Number of seconds to wait for a stop result.
      See Also:
  • Constructor Details

    • StopJob

      public StopJob()
  • Method Details

    • setExecutorService

      @Inject public void setExecutorService(ExecutorService executorService)
    • setJob

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

      public Stoppable getJob()
      Get the node to stop.
      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.
    • onStop

      protected void onStop() throws FailedToStopException
      Description copied from class: SimpleJob
      Allow sub classes to do something on stop.
      Overrides:
      onStop in class SimpleJob
      Throws:
      FailedToStopException