Interface Job


public interface Job
A job executed in a JobController, grouping one or several process.

The job life cycle can be controlled with the run(), resume() and suspend() and interrupt() methods.

Author:
Julien Viet
  • Method Details

    • id

      int id()
      Returns:
      the job id
    • status

      ExecStatus status()
      Returns:
      the job exec status
    • lastStopped

      long lastStopped()
      Returns:
      when the job was last stopped
    • line

      String line()
      Returns:
      the execution line of the job, i.e the shell command line that launched this job
    • setTty

      Job setTty(Tty tty)
      Set a tty on the job.
      Parameters:
      tty - the tty to use
      Returns:
      this object
    • setSession

      Job setSession(Session session)
      Set a session on the job.
      Parameters:
      session - the session to use
      Returns:
      this object
    • statusUpdateHandler

      Job statusUpdateHandler(Handler<ExecStatus> handler)
      Set an handler called when the job terminates.
      Parameters:
      handler - the terminate handler
      Returns:
      this object
    • run

      Job run()
      Run the job, before running the job a Tty must be set.
      Returns:
      this object
    • interrupt

      boolean interrupt()
      Attempt to interrupt the job.
      Returns:
      true if the job is actually interrupted
    • resume

      default Job resume()
      Resume the job to foreground.
    • toBackground

      Job toBackground()
      Send the job to background.
      Returns:
      this object
    • toForeground

      Job toForeground()
      Send the job to foreground.
      Returns:
      this object
    • resume

      Job resume(boolean foreground)
      Resume the job.
      Parameters:
      foreground - true when the job is resumed in foreground
    • suspend

      Job suspend()
      Resume the job.
      Returns:
      this object
    • terminate

      void terminate()
      Terminate the job.
    • process

      Process process()
      Returns:
      the first process in the job