Package backtraceio.library.watchdog
Class BacktraceWatchdog
- java.lang.Object
-
- backtraceio.library.watchdog.BacktraceWatchdog
-
public class BacktraceWatchdog extends java.lang.Object
Watchdog to monitor that any thread has blocked
-
-
Constructor Summary
Constructors Constructor Description BacktraceWatchdog(BacktraceClient client)
BacktraceWatchdog(BacktraceClient client, boolean sendException)
Initialize new instance of BacktraceWatchdog
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activateWatcher(java.lang.Thread thread)
Activate the watcher associated with the thread to resume monitoring the threadboolean
checkIsAnyThreadIsBlocked()
Check if any of the registered threads are blockedvoid
deactivateWatcher(java.lang.Thread thread)
Deactivate the thread watcher associated with the thread to temporarily stop monitoring the threadvoid
registerThread(java.lang.Thread thread, int timeout, int delay)
Register a thread to monitor itvoid
setOnApplicationNotRespondingEvent(OnApplicationNotRespondingEvent onApplicationNotRespondingEvent)
Set event that will be executed instead of the default sending of the error information to the Backtrace consolevoid
tick(java.lang.Thread thread)
Increase the counter associated with the threadvoid
unRegisterThread(java.lang.Thread thread)
-
-
-
Constructor Detail
-
BacktraceWatchdog
public BacktraceWatchdog(BacktraceClient client, boolean sendException)
Initialize new instance of BacktraceWatchdog- Parameters:
client
- current Backtrace client instance which will be used to send information about exceptionsendException
- whether to make a request to the server with information about the error
-
BacktraceWatchdog
public BacktraceWatchdog(BacktraceClient client)
-
-
Method Detail
-
setOnApplicationNotRespondingEvent
public void setOnApplicationNotRespondingEvent(OnApplicationNotRespondingEvent onApplicationNotRespondingEvent)
Set event that will be executed instead of the default sending of the error information to the Backtrace console- Parameters:
onApplicationNotRespondingEvent
- event that will be executed instead of the default sending of the error information to the Backtrace console
-
checkIsAnyThreadIsBlocked
public boolean checkIsAnyThreadIsBlocked()
Check if any of the registered threads are blocked- Returns:
- if any thread is blocked
-
registerThread
public void registerThread(java.lang.Thread thread, int timeout, int delay)
Register a thread to monitor it- Parameters:
thread
- thread which should be monitoredtimeout
- time in milliseconds after which we consider the thread to be blockeddelay
- time delay in milliseconds after which the thread should be monitored
-
unRegisterThread
public void unRegisterThread(java.lang.Thread thread)
- Parameters:
thread
- thread which should stop being monitored
-
tick
public void tick(java.lang.Thread thread)
Increase the counter associated with the thread- Parameters:
thread
- thread whose counter should be increased
-
activateWatcher
public void activateWatcher(java.lang.Thread thread)
Activate the watcher associated with the thread to resume monitoring the thread- Parameters:
thread
- thread whose counter should be activate
-
deactivateWatcher
public void deactivateWatcher(java.lang.Thread thread)
Deactivate the thread watcher associated with the thread to temporarily stop monitoring the thread- Parameters:
thread
- thread whose watcher should be deactivate
-
-