Package org.zeroturnaround.process
Class UnixProcess
java.lang.Object
org.zeroturnaround.process.AbstractProcess
org.zeroturnaround.process.PollingProcess
org.zeroturnaround.process.PidProcess
org.zeroturnaround.process.UnixProcess
- All Implemented Interfaces:
SystemProcess
Process implementation for UNIX PID values.
It uses the getpgid system call for checking the status and the kill one for
destroying the process.
-
Field Summary
Fields inherited from class org.zeroturnaround.process.PidProcess
pidFields inherited from class org.zeroturnaround.process.AbstractProcess
log -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.zeroturnaround.process.PidProcess
getDescription, getPidMethods inherited from class org.zeroturnaround.process.PollingProcess
getIntervalForCheckingFinished, setIntervalForCheckingFinished, waitForMethods inherited from class org.zeroturnaround.process.AbstractProcess
destroyForcefully, destroyGracefully, toString, waitFor
-
Constructor Details
-
UnixProcess
public UnixProcess(int pid)
-
-
Method Details
-
isAlive
Description copied from interface:SystemProcessTests whether this process is alive.This operation may take some time to finish.
- Returns:
trueif this process is alive,falseif it is finished or not found.- Throws:
IOException- on IO error.
-
destroy
Description copied from class:AbstractProcessDestroys the process either forcefully or gracefully according to the given option.Note: The process may not terminate at all. i.e.
isAlive()may returntruefor a any period afterdestroy()is called. This method may be chained towaitFor()if needed.No error is thrown if the process was already terminated.
- Specified by:
destroyin classAbstractProcess- Parameters:
forceful-trueif the process must be destroyed forcefully (likekill -KILL),falseif it must be destroyed gracefully (likekill -TERM).- Throws:
IOException- on IO error.
-
kill
Sends a signal to this process.- Parameters:
signal- name of the signal.- Returns:
trueif this process received the signal,falseif this process was not found (any more).- Throws:
IOException- on system call error.
-