public class Java8Process extends JavaProcess
Process since Java 8.
Java 8 added following methods:
isAlive()destroyForcibly()waitFor(long, TimeUnit)process| Constructor and Description |
|---|
Java8Process(Process process) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
canDestroy(boolean forceful) |
protected void |
invokeDestroy(boolean forceful) |
Process |
invokeDestroyForcibly() |
boolean |
isAlive()
Tests whether this process is alive.
|
static boolean |
isSupported() |
boolean |
waitFor(long timeout,
TimeUnit unit)
Causes the current thread to wait, if necessary, until the process handled by this killer has terminated, or the specified timeout is reached.
|
destroy, getDescription, getProcess, waitFordestroyForcefully, destroyGracefully, toStringpublic Java8Process(Process process)
public static boolean isSupported()
protected boolean canDestroy(boolean forceful)
canDestroy in class JavaProcesstrue if JavaProcess.invokeDestroy(boolean) is supported with the given forceful flag on the given system.protected void invokeDestroy(boolean forceful)
invokeDestroy in class JavaProcesspublic Process invokeDestroyForcibly()
public boolean isAlive()
SystemProcessThis operation may take some time to finish.
isAlive in interface SystemProcessisAlive in class JavaProcesstrue if this process is alive, false if it is finished or not found.public boolean waitFor(long timeout,
TimeUnit unit)
throws InterruptedException
AbstractProcess
If the process has already terminated then this method returns immediately with the value true.
If the process has not terminated and the timeout value is less than, or equal to, zero, then this method returns immediately with the value false.
waitFor in interface SystemProcesswaitFor in class AbstractProcesstimeout - the maximum time to waitunit - the time unit of the timeout argumenttrue if the process has exited and false if the timeout is reached before the process has exited.InterruptedExceptionCopyright © 2017 ZeroTurnaround. All rights reserved.