Package cn.sliew.milky.common.watchdog
Interface ThreadWatchdog
-
- All Known Implementing Classes:
DefaultThreadWatchdog,Noop
public interface ThreadWatchdogProtects against long running operations that happen between the register and unregister invocations. eg. Threads that invokeregister(), but take too long to invoke theunregister()method will be interrupted.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longmaxExecutionTimeInMillis()voidregister()Registers the current thread and interrupts the current thread if the takes too long for this thread to invokeunregister().voidunregister()Unregisters the current thread and prevents it from being interrupted.
-
-
-
Method Detail
-
register
void register()
Registers the current thread and interrupts the current thread if the takes too long for this thread to invokeunregister().
-
maxExecutionTimeInMillis
long maxExecutionTimeInMillis()
- Returns:
- The maximum allowed time in milliseconds for a thread to invoke
unregister()afterregister()has been invoked before this ThreadWatchDog starts to interrupting that thread.
-
unregister
void unregister()
Unregisters the current thread and prevents it from being interrupted.
-
-