|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zeroturnaround.process.AbstractProcess
public abstract class AbstractProcess
Base implementation of the process.
| Field Summary | |
|---|---|
protected org.slf4j.Logger |
log
|
| Constructor Summary | |
|---|---|
AbstractProcess()
|
|
| Method Summary | |
|---|---|
abstract void |
destroy(boolean forceful)
Destroys the process handled by this killer either forcefully or gracefully according to the given option. |
AbstractProcess |
destroyForcefully()
Kills the process handled by this killer. |
AbstractProcess |
destroyGracefully()
Terminates the process handled by this killer. |
protected abstract String |
getDescription()
Returns the description of the system process represented. |
String |
toString()
|
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 waiting time elapses. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.zeroturnaround.process.SystemProcess |
|---|
isAlive, waitFor |
| Field Detail |
|---|
protected final org.slf4j.Logger log
| Constructor Detail |
|---|
public AbstractProcess()
| Method Detail |
|---|
public String toString()
toString in class Objectprotected abstract String getDescription()
public boolean waitFor(long timeout,
TimeUnit unit)
throws InterruptedException
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 SystemProcesstimeout - the maximum time to waitunit - the time unit of the timeout argument
true if the process has exited and false if the waiting time elapsed before the process has exited.
InterruptedException
public AbstractProcess destroyGracefully()
throws IOException,
InterruptedException,
UnsupportedOperationException
kill -TERM does).
Note: The process may not terminate at all.
i.e. isAlive() may return true for a any period after destroyGracefully() is called.
This method may be chained to waitFor() if needed.
No error is thrown if the process was already terminated.
destroyGracefully in interface SystemProcessUnsupportedOperationException - if this killer object is unable to gracefully terminate any process.
IOException
InterruptedException
public AbstractProcess destroyForcefully()
throws IOException,
InterruptedException,
UnsupportedOperationException
kill -KILL does).
Note: The process may not terminate immediately.
i.e. isAlive() may return true for a brief period after destroyForcefully() is called.
This method may be chained to waitFor() if needed.
No error is thrown if the process was already terminated.
destroyForcefully in interface SystemProcessUnsupportedOperationException - if this killer object is unable to forcibly terminate any process.
IOException
InterruptedException
public abstract void destroy(boolean forceful)
throws IOException,
InterruptedException
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.
forceful - true if the process must be destroyed forcefully (like kill -KILL),
false if it must be destroyed gracefully (like kill -TERM).
UnsupportedOperationException - if this killer object is unable to destroy any process with this forceful value.
IOException
InterruptedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||