[jsscripting] Remove Thread.sleep workaround for multi-threading issues with UI-based scripts (#17630)

Follow-up for #1710.
Depends on https://github.com/openhab/openhab-core/pull/4426.

Signed-off-by: Florian Hotze <dev@florianhotze.com>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
Florian Hotze 2024-10-26 23:27:41 +02:00 committed by Ciprian Pascu
parent abbd1b9daa
commit 9a7c81eda5

View File

@ -304,13 +304,6 @@ public class OpenhabGraalJSScriptEngine
protected Object afterInvocation(Object obj) { protected Object afterInvocation(Object obj) {
lock.unlock(); lock.unlock();
logger.debug("Lock released after invocation."); logger.debug("Lock released after invocation.");
// Fixes illegal multi-thread access requested in UI-based scripts, where the script is running and a timer is
// waiting to acquire the lock.
try {
Thread.sleep(10);
} catch (InterruptedException e) {
throw new RuntimeException("Thread interrupted while sleeping", e);
}
return super.afterInvocation(obj); return super.afterInvocation(obj);
} }
@ -385,13 +378,6 @@ public class OpenhabGraalJSScriptEngine
public void unlock() { public void unlock() {
lock.unlock(); lock.unlock();
logger.debug("Lock released."); logger.debug("Lock released.");
// Fixes illegal multi-thread access requested in UI-based scripts, where the script is running and a timer is
// waiting to acquire the lock.
try {
Thread.sleep(10);
} catch (InterruptedException e) {
throw new RuntimeException("Thread interrupted while sleeping", e);
}
} }
@Override @Override