Skip to content

Commit abe8199

Browse files
authored
[jsscripting] Remove Thread.sleep workaround for multi-threading issues with UI-based scripts (openhab#17630)
Follow-up for openhab#1710. Depends on openhab/openhab-core#4426. Signed-off-by: Florian Hotze <[email protected]>
1 parent f52cede commit abe8199

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

bundles/org.openhab.automation.jsscripting/src/main/java/org/openhab/automation/jsscripting/internal/OpenhabGraalJSScriptEngine.java

-14
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,6 @@ protected void beforeInvocation() {
304304
protected Object afterInvocation(Object obj) {
305305
lock.unlock();
306306
logger.debug("Lock released after invocation.");
307-
// Fixes illegal multi-thread access requested in UI-based scripts, where the script is running and a timer is
308-
// waiting to acquire the lock.
309-
try {
310-
Thread.sleep(10);
311-
} catch (InterruptedException e) {
312-
throw new RuntimeException("Thread interrupted while sleeping", e);
313-
}
314307
return super.afterInvocation(obj);
315308
}
316309

@@ -385,13 +378,6 @@ public boolean tryLock(long l, TimeUnit timeUnit) throws InterruptedException {
385378
public void unlock() {
386379
lock.unlock();
387380
logger.debug("Lock released.");
388-
// Fixes illegal multi-thread access requested in UI-based scripts, where the script is running and a timer is
389-
// waiting to acquire the lock.
390-
try {
391-
Thread.sleep(10);
392-
} catch (InterruptedException e) {
393-
throw new RuntimeException("Thread interrupted while sleeping", e);
394-
}
395381
}
396382

397383
@Override

0 commit comments

Comments
 (0)