Package org.jline.shell.impl
Class DefaultJobManager
- java.lang.Object
-
- org.jline.shell.impl.DefaultJobManager
-
- All Implemented Interfaces:
JobManager
public class DefaultJobManager extends java.lang.Object implements JobManager
Default implementation ofJobManager.Tracks jobs using an internal list and notifies registered listeners on status changes.
- Since:
- 4.0
-
-
Constructor Summary
Constructors Constructor Description DefaultJobManager()Creates a new DefaultJobManager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddJobListener(JobListener listener)Adds a job listener.voidcompleteJob(DefaultJob job)Marks a job as done and fires listeners.DefaultJobcreateJob(java.lang.String command, java.lang.Thread thread)Creates a new foreground job for the given command and thread.JobforegroundJob()Returns the current foreground job, ornullif no job is in the foreground.Jobget(long id)Returns the job with the specified id, ornullif not found.java.util.List<Job>jobs()Returns all tracked jobs.voidremoveJob(Job job)Removes a job from the managed list.voidremoveJobListener(JobListener listener)Removes a job listener.
-
-
-
Method Detail
-
foregroundJob
public Job foregroundJob()
Description copied from interface:JobManagerReturns the current foreground job, ornullif no job is in the foreground.- Specified by:
foregroundJobin interfaceJobManager- Returns:
- the foreground job, or null
-
jobs
public java.util.List<Job> jobs()
Description copied from interface:JobManagerReturns all tracked jobs.- Specified by:
jobsin interfaceJobManager- Returns:
- list of all jobs
-
get
public Job get(long id)
Description copied from interface:JobManagerReturns the job with the specified id, ornullif not found.- Specified by:
getin interfaceJobManager- Parameters:
id- the job id- Returns:
- the job, or null
-
addJobListener
public void addJobListener(JobListener listener)
Description copied from interface:JobManagerAdds a job listener.- Specified by:
addJobListenerin interfaceJobManager- Parameters:
listener- the listener to add
-
removeJobListener
public void removeJobListener(JobListener listener)
Description copied from interface:JobManagerRemoves a job listener.- Specified by:
removeJobListenerin interfaceJobManager- Parameters:
listener- the listener to remove
-
createJob
public DefaultJob createJob(java.lang.String command, java.lang.Thread thread)
Creates a new foreground job for the given command and thread.- Parameters:
command- the command stringthread- 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
-
-