Skip to content

Commit

Permalink
[jsscripting] Remove Thread.sleep workaround for multi-threading issu…
Browse files Browse the repository at this point in the history
…es with UI-based scripts

Follow-up for openhab#1710.
Depends on openhab/openhab-core#4426.

Signed-off-by: Florian Hotze <dev@florianhotze.com>
  • Loading branch information
florian-h05 committed Oct 26, 2024
1 parent af67423 commit 554495b
Showing 1 changed file with 0 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,6 @@ protected void beforeInvocation() {
protected Object afterInvocation(Object obj) {
lock.unlock();
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);
}

Expand Down Expand Up @@ -385,13 +378,6 @@ public boolean tryLock(long l, TimeUnit timeUnit) throws InterruptedException {
public void unlock() {
lock.unlock();
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
Expand Down

0 comments on commit 554495b

Please sign in to comment.