Interface Job
public interface Job
A job executed in a
JobController, grouping one or several process.
The job life cycle can be controlled with the run(), resume() and suspend() and interrupt()
methods.- Author:
- Julien Viet
-
Method Summary
Modifier and TypeMethodDescriptionintid()booleanAttempt to interrupt the job.longline()process()default Jobresume()Resume the job to foreground.resume(boolean foreground) Resume the job.run()Run the job, before running the job aTtymust be set.setSession(Session session) Set a session on the job.Set a tty on the job.status()statusUpdateHandler(Handler<ExecStatus> handler) Set an handler called when the job terminates.suspend()Resume the job.voidTerminate the job.Send the job to background.Send the job to foreground.
-
Method Details
-
id
int id()- Returns:
- the job id
-
status
ExecStatus status()- Returns:
- the job exec status
-
lastStopped
long lastStopped()- Returns:
- when the job was last stopped
-
line
String line()- Returns:
- the execution line of the job, i.e the shell command line that launched this job
-
setTty
-
setSession
-
statusUpdateHandler
Set an handler called when the job terminates.- Parameters:
handler- the terminate handler- Returns:
- this object
-
run
-
interrupt
boolean interrupt()Attempt to interrupt the job.- Returns:
- true if the job is actually interrupted
-
resume
Resume the job to foreground. -
toBackground
-
toForeground
-
resume
Resume the job.- Parameters:
foreground- true when the job is resumed in foreground
-
suspend
-
terminate
void terminate()Terminate the job. -
process
Process process()- Returns:
- the first process in the job
-