Class DefaultJob

java.lang.Object
org.jline.shell.impl.DefaultJob
All Implemented Interfaces:
Job

public class DefaultJob extends Object implements Job
Default implementation of Job.

Wraps a Thread reference and tracks the job's lifecycle status.

Since:
4.0
  • Constructor Details

    • DefaultJob

      public DefaultJob(long id, String command, Thread thread)
      Creates a new job.
      Parameters:
      id - the job id
      command - the command string
      thread - the thread executing the command
  • Method Details

    • id

      public long id()
      Description copied from interface: Job
      Returns the unique identifier for this job.
      Specified by:
      id in interface Job
      Returns:
      the job id
    • command

      public String command()
      Description copied from interface: Job
      Returns the command string associated with this job.
      Specified by:
      command in interface Job
      Returns:
      the command string
    • status

      public Job.Status status()
      Description copied from interface: Job
      Returns the current status of this job.
      Specified by:
      status in interface Job
      Returns:
      the job status
    • setStatus

      public void setStatus(Job.Status status)
      Sets the status of this job.
      Parameters:
      status - the new status
    • thread

      public Thread thread()
      Returns the thread executing this job.
      Returns:
      the thread
    • interrupt

      public void interrupt()
      Description copied from interface: Job
      Interrupts this job.
      Specified by:
      interrupt in interface Job
    • suspend

      public void suspend()
      Description copied from interface: Job
      Suspends this job.
      Specified by:
      suspend in interface Job
    • resume

      public void resume(boolean foreground)
      Description copied from interface: Job
      Resumes this job.
      Specified by:
      resume in interface Job
      Parameters:
      foreground - if true, resume in foreground; otherwise resume in background