var ReentrantLock lock = new ReentrantLock()
rule "Alarm Triggered"
when
Item Alarms received update
then
var boolean gotLock = lock.tryLock()
try {
if(gotLock) {
logInfo("Testing", "Alarms received update")
val alarm = Alarms.members.filter[Contact s|s.lastUpdate("mapdb") != null].sortBy[lastUpdate("mapdb")].last
if (alarm.state == OPEN) {
logInfo("Testing", "Test: " + alarm.label)
}
}
}
catch(Exception e) {
logError("Alarms:", "Exception in rule 'Alarms': " + e.toString)
}
finally {
if(gotLock) {
lock.unlock()
}
}
end
This was working, but now I am seeing:
2017-07-07 11:50:39.615 [ERROR] [org.eclipse.smarthome.model.script.Alarms:] - Exception in rule 'Alarms': java.lang.RuntimeException: The name '<XFeatureCallImplCustom>.lastUpdate(<XStringLiteralImpl>)' cannot be resolved to an item or type.
Based on a separate thread this user found some lastUpdate times WAY in the future. Do all the items in your group have reasonable last update times if you print them separately?