public class AndProcess extends CompositeProcess
It tries to kill all child processes.
If it fails to destroy any process it still tries to destroy other processes before actually throwing the initial error.
isAlive() returns true if at least one of the processes is still alive.
isAllAlive() returns true only if all processes are still alive.
If it has only one child it acts the same as invoking the same method directly on the child.
childrenlog| Constructor and Description |
|---|
AndProcess(List<? extends SystemProcess> children) |
| 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.
|
boolean |
isAllAlive() |
void |
waitFor()
Causes the current thread to wait, if necessary, until this process has terminated.
|
getDescription, invokeDestroy, toStringdestroyForcefully, destroyGracefully, waitForpublic AndProcess(List<? extends SystemProcess> children)
public 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.IOException - on IO error.InterruptedException - if interrupted.public boolean isAllAlive()
throws IOException,
InterruptedException
IOExceptionInterruptedExceptionpublic void waitFor()
throws InterruptedException
SystemProcessThis method returns immediately if the process has already terminated. If the process has not yet terminated, the calling thread will be blocked until the process exits.
InterruptedException - if interrupted.public 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).IOException - on IO error.InterruptedException - if interrupted.Copyright © 2019 ZeroTurnaround. All rights reserved.