Package org.jline.shell.impl
Class DefaultJobManager
java.lang.Object
org.jline.shell.impl.DefaultJobManager
- All Implemented Interfaces:
JobManager
Default implementation of
JobManager.
Tracks jobs using an internal list and notifies registered listeners on status changes.
- Since:
- 4.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddJobListener(JobListener listener) Adds a job listener.voidcompleteJob(DefaultJob job) Marks a job as done and fires listeners.Creates a new foreground job for the given command and thread.Returns the current foreground job, ornullif no job is in the foreground.get(long id) Returns the job with the specified id, ornullif not found.jobs()Returns all tracked jobs.voidRemoves a job from the managed list.voidremoveJobListener(JobListener listener) Removes a job listener.
-
Constructor Details
-
DefaultJobManager
public DefaultJobManager()Creates a new DefaultJobManager.
-
-
Method Details
-
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
Description copied from interface:JobManagerReturns all tracked jobs.- Specified by:
jobsin interfaceJobManager- Returns:
- list of all jobs
-
get
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
Description copied from interface:JobManagerAdds a job listener.- Specified by:
addJobListenerin interfaceJobManager- Parameters:
listener- the listener to add
-
removeJobListener
Description copied from interface:JobManagerRemoves a job listener.- Specified by:
removeJobListenerin interfaceJobManager- Parameters:
listener- the listener to remove
-
createJob
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
Marks a job as done and fires listeners.- Parameters:
job- the job to complete
-
removeJob
Removes a job from the managed list.- Parameters:
job- the job to remove
-