public class UnixProcess extends PidProcess
It uses the kill command for both checking the status and destroying the process.
pidlog| Constructor and Description |
|---|
UnixProcess(int pid) |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy(boolean forceful)
Destroys the process either forcefully or gracefully according to the given option.
|
boolean |
isAlive()
Tests whether this process is alive.
|
protected boolean |
isNoSuchProcess(org.zeroturnaround.exec.InvalidExitValueException e) |
boolean |
kill(String signal)
Sends a signal to this process.
|
getDescription, getPidgetIntervalForCheckingFinished, setIntervalForCheckingFinished, waitFordestroyForcefully, destroyGracefully, toString, waitForpublic boolean isAlive()
throws IOException,
InterruptedException
SystemProcessThis operation may take some time to finish.
true if this process is alive, false if it is finished or not found.IOExceptionInterruptedExceptionpublic void destroy(boolean forceful)
throws IOException,
InterruptedException
AbstractProcess
Note: The process may not terminate at all.
i.e. isAlive() may return true for a any period after destroy() is called.
This method may be chained to waitFor() if needed.
No error is thrown if the process was already terminated.
destroy in class AbstractProcessforceful - true if the process must be destroyed forcefully (like kill -KILL),
false if it must be destroyed gracefully (like kill -TERM).IOExceptionInterruptedExceptionpublic boolean kill(String signal) throws IOException, InterruptedException
signal - name of the signal.true if this process received the signal, false if this process was not found (any more).IOExceptionInterruptedExceptionprotected boolean isNoSuchProcess(org.zeroturnaround.exec.InvalidExitValueException e)
true if this exception indicates that the process was not found (any more).Copyright © 2017 ZeroTurnaround. All rights reserved.