mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[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:
parent
abbd1b9daa
commit
9a7c81eda5
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user