Interface ThreadWatchdog

  • All Known Implementing Classes:
    DefaultThreadWatchdog, Noop

    public interface ThreadWatchdog
    Protects against long running operations that happen between the register and unregister invocations. eg. Threads that invoke register(), but take too long to invoke the unregister() method will be interrupted.
    • Method Detail

      • register

        void register()
        Registers the current thread and interrupts the current thread if the takes too long for this thread to invoke unregister().
      • maxExecutionTimeInMillis

        long maxExecutionTimeInMillis()
        Returns:
        The maximum allowed time in milliseconds for a thread to invoke unregister() after register() has been invoked before this ThreadWatchDog starts to interrupting that thread.
      • unregister

        void unregister()
        Unregisters the current thread and prevents it from being interrupted.