Class DefaultJobManager

java.lang.Object
org.jline.shell.impl.DefaultJobManager
All Implemented Interfaces:
JobManager

public class DefaultJobManager extends Object implements JobManager
Default implementation of JobManager.

Tracks jobs using an internal list and notifies registered listeners on status changes.

Since:
4.0
  • Constructor Details

    • DefaultJobManager

      public DefaultJobManager()
      Creates a new DefaultJobManager.
  • Method Details

    • foregroundJob

      public Job foregroundJob()
      Description copied from interface: JobManager
      Returns the current foreground job, or null if no job is in the foreground.
      Specified by:
      foregroundJob in interface JobManager
      Returns:
      the foreground job, or null
    • jobs

      public List<Job> jobs()
      Description copied from interface: JobManager
      Returns all tracked jobs.
      Specified by:
      jobs in interface JobManager
      Returns:
      list of all jobs
    • get

      public Job get(long id)
      Description copied from interface: JobManager
      Returns the job with the specified id, or null if not found.
      Specified by:
      get in interface JobManager
      Parameters:
      id - the job id
      Returns:
      the job, or null
    • addJobListener

      public void addJobListener(JobListener listener)
      Description copied from interface: JobManager
      Adds a job listener.
      Specified by:
      addJobListener in interface JobManager
      Parameters:
      listener - the listener to add
    • removeJobListener

      public void removeJobListener(JobListener listener)
      Description copied from interface: JobManager
      Removes a job listener.
      Specified by:
      removeJobListener in interface JobManager
      Parameters:
      listener - the listener to remove
    • createJob

      public DefaultJob createJob(String command, Thread thread)
      Creates a new foreground job for the given command and thread.
      Parameters:
      command - the command string
      thread - the thread executing the command
      Returns:
      the new job
    • completeJob

      public void completeJob(DefaultJob job)
      Marks a job as done and fires listeners.
      Parameters:
      job - the job to complete
    • removeJob

      public void removeJob(Job job)
      Removes a job from the managed list.
      Parameters:
      job - the job to remove