|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.bamboo.executor.InterruptThreadWatchdog
@ThreadSafe public abstract class InterruptThreadWatchdog
An abstract class for interrupting a thread after a given timeout. onBeforeInterrupt(Thread)
is for
implementors adding logical logging comments
Constructor Summary | |
---|---|
InterruptThreadWatchdog(long timeoutSeconds,
java.lang.Thread thread)
Creates a new watchdog with a given timeoutSeconds. |
Method Summary | |
---|---|
long |
getTimeoutSeconds()
|
boolean |
isThreadInterrupted()
Indicates whether the thread run was killed on timeoutSeconds or not. |
protected abstract void |
onBeforeInterrupt(java.lang.Thread thread)
Forced extension point, usually would just have some intelligent logging. |
void |
start()
Watches the given process and terminates it, if it runs for too long. |
void |
stop()
Stops the watcher. |
void |
timeoutOccured(org.apache.tools.ant.util.Watchdog w)
Called after watchdog has finished. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InterruptThreadWatchdog(long timeoutSeconds, @NotNull java.lang.Thread thread)
timeoutSeconds
- the timeout for the thread in seconds. It must be greater than 0.thread
- Method Detail |
---|
public void start()
process
- the process to monitor. It cannot be null
java.lang.IllegalStateException
- if a process is still being monitored.public void stop()
public void timeoutOccured(org.apache.tools.ant.util.Watchdog w)
timeoutOccured
in interface org.apache.tools.ant.util.TimeoutObserver
w
- the watchdogprotected abstract void onBeforeInterrupt(java.lang.Thread thread)
thread
- public boolean isThreadInterrupted()
public long getTimeoutSeconds()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |