EventLockWatchdog
com.jsmacrosce.jsmacros.core.EventLockWatchdog
Monitors an event-container lock and closes its script context if the lock remains held at the timed check.
js
const Watchdog = Java.type("com.jsmacrosce.jsmacros.core.EventLockWatchdog");
const run = JsMacros.runScript("js", "const result = 1 + 1;");
Watchdog.startWatchdog(run, null, 1000);Nested types
Constructors
new EventLockWatchdog
new EventLockWatchdog()#Methods
startWatchdog
static startWatchdog(EventContainer<?> lock, IEventListener listener, long maxTime): void#Starts a lock monitor using the container's context and runner. After the delay, the monitor checks whether the lock is held; if so, it disables a BaseListener listener, closes the context, and logs a WatchdogException. A release observed at the check avoids those actions; a release after the check may still race with them. Other listener implementations are not disabled.
Parameters:
lock: non-null container with a non-null context and initialized runner thread poollistener: nullable listener; only a BaseListener is disabled when the timed check finds the lock heldmaxTime: nonnegative delay before the timed check, in milliseconds