Exception within ReentrantLock block in rule halt the overal jobscheduler

It took me a couple hours today to figure out that the scheduler in OpenHAB stopped executing jobs because one rule was dead locked. Below the short version of the rule.
If within a ReentrantLock block an exception is raised the unlock in the finally won’t be called. The exception causes to halt the jobscheduler. It took a while to understand that the rule was causing this issue, because no error was raised within the log files. Adding a catch statement did not help either.
I changed the rule, so it won’t raise an exception.

import org.openhab.core.library.types.*
import org.openhab.model.script.actions.*
import org.joda.time.*
import java.util.concurrent.locks.ReentrantLock

var java.util.concurrent.locks.ReentrantLock lock = new java.util.concurrent.locks.ReentrantLock()

rule “Rule using curl which blocks scheduler”
when
System started or
// Every 15 seconds
or Time cron “*/15 * * * * ?”
then
lock.lock()
try {
if (NonExistentItem.state == Uninitialized) {
logInfo(“Test”, “Test”)
}
} finally{
lock.unlock()
}
end

Always a good policy.

This is kind of disturbing, though not outside of my experience with trying to do other things (e.g. using break). In your catch, did you try catching Throwable or just Exception?