Class DefaultJob

  • All Implemented Interfaces:
    Job

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

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

    Since:
    4.0
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.jline.shell.Job

        Job.Status
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultJob​(long id, java.lang.String command, java.lang.Thread thread)
      Creates a new job.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String command()
      Returns the command string associated with this job.
      long id()
      Returns the unique identifier for this job.
      void interrupt()
      Interrupts this job.
      void resume​(boolean foreground)
      Resumes this job.
      void setStatus​(Job.Status status)
      Sets the status of this job.
      Job.Status status()
      Returns the current status of this job.
      void suspend()
      Suspends this job.
      java.lang.Thread thread()
      Returns the thread executing this job.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultJob

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

      • 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 java.lang.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 java.lang.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