@ThreadSafe public abstract class InterruptThreadWatchdog extends Object implements org.apache.tools.ant.util.TimeoutObserver
onBeforeInterrupt(Thread)
is for
implementors adding logical logging commentsConstructor and Description |
---|
InterruptThreadWatchdog(long timeoutSeconds,
Thread thread)
Creates a new watchdog with a given timeoutSeconds.
|
Modifier and Type | Method and Description |
---|---|
long |
getTimeoutSeconds() |
boolean |
isThreadInterrupted()
Indicates whether the thread run was killed on timeoutSeconds or not.
|
protected abstract void |
onBeforeInterrupt(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.
|
public InterruptThreadWatchdog(long timeoutSeconds, @NotNull Thread thread)
timeoutSeconds
- the timeout for the thread in seconds. It must be greater than 0.thread
- public void start()
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(Thread thread)
thread
- public boolean isThreadInterrupted()
public long getTimeoutSeconds()
Copyright © 2020 Atlassian Software Systems Pty Ltd. All rights reserved.