|
Spring AMQP | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.util.exec.ExecuteWatchdog
public class ExecuteWatchdog
Destroys a process running for too long. For example:
ExecuteWatchdog watchdog = new ExecuteWatchdog(30000);
Execute exec = new Execute(myloghandler, watchdog);
exec.setCommandLine(mycmdline);
int exitvalue = exec.execute();
if (exitvalue != SUCCESS && watchdog.killedProcess()){
// it was killed on purpose by the watchdog
}
Execute| Constructor Summary | |
|---|---|
ExecuteWatchdog(int timeout)
Creates a new watchdog with a given timeout. |
|
| Method Summary | |
|---|---|
protected void |
cleanUp()
reset the monitor flag and the process. |
Exception |
getException()
|
boolean |
isWatching()
Indicates whether or not the watchdog is still monitoring the process. |
boolean |
killedProcess()
Indicates whether the last process run was killed on timeout or not. |
void |
run()
Watches the process and terminates it, if it runs for too long. |
void |
setDontkill(boolean b)
|
void |
start(Process process,
Thread execThread)
Watches the given process and terminates it, if it runs for too long. |
void |
stop()
Stops the watcher. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ExecuteWatchdog(int timeout)
timeout - the timeout for the process in milliseconds. It must be greather than 0.| Method Detail |
|---|
public void setDontkill(boolean b)
public void start(Process process,
Thread execThread)
process - the process to monitor. It cannot be null
IllegalStateException - thrown if a process is still being monitored.public void stop()
public void run()
run in interface Runnableprotected void cleanUp()
public Exception getException()
public boolean isWatching()
public boolean killedProcess()
|
Spring AMQP | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||