quarks.execution

Interface Job

  • All Known Implementing Classes:
    quarks.graph.spi.execution.AbstractGraphJob, EtiaoJob


    public interface Job
    Actions and states for execution of a Quarks job.

    The interface provides the main job lifecycle control, taking on the following execution state values:

    • CONSTRUCTED This job has been constructed but the nodes are not yet initialized.
    • INITIALIZED This job has been initialized and is ready to process data.
    • RUNNING This job is processing data.
    • PAUSED This job is paused.
    • CLOSED This job is closed.
    The interface provides access to two state values:
    • Current - The current state of execution when the job is not executing a state transition; the source state while the job is making a state transition after the client code calls stateChange(Job.Action).
    • Next - The destination state while the job is making a state transition; same as the current state while the job state is stable (that is, not making a transition).
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface and Description
      static class  Job.Action
      Actions which trigger Job.State transitions.
      static class  Job.State
      States of a graph job.
    • Method Detail

      • getCurrentState

        Job.State getCurrentState()
        Retrieves the current state of this job.
        Returns:
        the current state.
      • getNextState

        Job.State getNextState()
        Retrieves the next execution state when this job makes a state transition.
        Returns:
        the destination state while in a state transition; otherwise the same as getCurrentState().
      • stateChange

        void stateChange(Job.Action action)
                  throws java.lang.IllegalArgumentException
        Initiates a State change.
        Parameters:
        action - which triggers the state change.
        Throws:
        java.lang.IllegalArgumentException - if the job is not in an appropriate state for the requested action, or the action is not supported.
      • getName

        java.lang.String getName()
        Returns the name of this job. The name may be set when the job is submitted. Implementations may create a job name if one is not specified at submit time.
        Returns:
        the job name.
      • getId

        java.lang.String getId()
        Returns the identifier of this job.
        Returns:
        this job identifier.
      • complete

        void complete()
               throws java.util.concurrent.ExecutionException,
                      java.lang.InterruptedException
        Waits for any outstanding job work to complete.
        Throws:
        java.util.concurrent.ExecutionException - if the job execution threw an exception.
        java.lang.InterruptedException - if the current thread was interrupted while waiting
      • complete

        void complete(long timeout,
                      java.util.concurrent.TimeUnit unit)
               throws java.util.concurrent.ExecutionException,
                      java.lang.InterruptedException,
                      java.util.concurrent.TimeoutException
        Waits for at most the specified time for the job to complete.
        Parameters:
        timeout - the time to wait
        unit - the time unit of the timeout argument
        Throws:
        java.util.concurrent.ExecutionException - if the job execution threw an exception.
        java.lang.InterruptedException - if the current thread was interrupted while waiting
        java.util.concurrent.TimeoutException - if the wait timed out

Copyright IBM 2015,2016 - 2f6ad0e-20160307-0902