and I want to seperate this discussion a bit, to avoid Hijacking the original discussion thread.
you are right. Thats new and will be released with openhab > 5.1 M1.
@florian-h05 I would guess that this will result in a deadlock. Except we remove the extra lock in beforeInvocation / afterInvocation, in javascripting and pythonscripting.
Currently we lock with the surrounding logic and additionally we try to lock again, as part of eval where we try to lock again.
But if we remove the lock inside eval, we have the risk that somewhere the eval is used without locking the engine first.
e.g. in the transformation service. This is not 100% a problem, because there is a separate lock, but still not the engine lock.
There’s a hint in the name of the implementation:
private final Lock lock = new ReentrantLock();
You can reenter locks as many times as you want in Java, I don’t think a non-reentrant lock implementations actually exists. It is “counted”, so the lock isn’t released until it has been unlocked the same number of times as it has been locked.