Class BacktraceWatchdog


  • public class BacktraceWatchdog
    extends java.lang.Object
    Watchdog to monitor that any thread has blocked
    • 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 thread
      boolean checkIsAnyThreadIsBlocked()
      Check if any of the registered threads are blocked
      void deactivateWatcher​(java.lang.Thread thread)
      Deactivate the thread watcher associated with the thread to temporarily stop monitoring the thread
      void registerThread​(java.lang.Thread thread, int timeout, int delay)
      Register a thread to monitor it
      void setOnApplicationNotRespondingEvent​(OnApplicationNotRespondingEvent onApplicationNotRespondingEvent)
      Set event that will be executed instead of the default sending of the error information to the Backtrace console
      void tick​(java.lang.Thread thread)
      Increase the counter associated with the thread
      void unRegisterThread​(java.lang.Thread thread)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 exception
        sendException - whether to make a request to the server with information about the error
    • 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 monitored
        timeout - time in milliseconds after which we consider the thread to be blocked
        delay - 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