-
public class BacktraceWatchdog
Watchdog to monitor that any thread has blocked
-
-
Field Summary
Fields Modifier and Type Field Description private OnApplicationNotRespondingEvent
onApplicationNotRespondingEvent
-
Constructor Summary
Constructors Constructor Description BacktraceWatchdog(BacktraceClient client, boolean sendException)
Initialize new instance of BacktraceWatchdog BacktraceWatchdog(BacktraceClient client)
-
Method Summary
Modifier and Type Method Description void
setOnApplicationNotRespondingEvent(OnApplicationNotRespondingEvent onApplicationNotRespondingEvent)
Set event that will be executed instead of the default sending of the error information to the Backtrace console boolean
checkIsAnyThreadIsBlocked()
Check if any of the registered threads are blocked void
registerThread(Thread thread, int timeout, int delay)
Register a thread to monitor it void
unRegisterThread(Thread thread)
void
tick(Thread thread)
Increase the counter associated with the thread void
activateWatcher(Thread thread)
Activate the watcher associated with the thread to resume monitoring the thread void
deactivateWatcher(Thread thread)
Deactivate the thread watcher associated with the thread to temporarily stop monitoring the thread -
-
Constructor Detail
-
BacktraceWatchdog
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
BacktraceWatchdog(BacktraceClient client)
-
-
Method Detail
-
setOnApplicationNotRespondingEvent
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
boolean checkIsAnyThreadIsBlocked()
Check if any of the registered threads are blocked
-
registerThread
void registerThread(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
void unRegisterThread(Thread thread)
- Parameters:
thread
- thread which should stop being monitored
-
tick
void tick(Thread thread)
Increase the counter associated with the thread
- Parameters:
thread
- thread whose counter should be increased
-
activateWatcher
void activateWatcher(Thread thread)
Activate the watcher associated with the thread to resume monitoring the thread
- Parameters:
thread
- thread whose counter should be activate
-
deactivateWatcher
void deactivateWatcher(Thread thread)
Deactivate the thread watcher associated with the thread to temporarily stop monitoring the thread
- Parameters:
thread
- thread whose watcher should be deactivate
-
-
-
-