Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Added try catch for updating value in simulator. Should schedule next update and log error

Michael Rademakeraaf9ac337bf0
diff --git a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java
index 724155cad..e8896626b 100644
--- a/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java
+++ b/agent/src/main/java/org/openremote/agent/protocol/simulator/SimulatorProtocol.java
@@ -565,8 +565,13 @@ public class SimulatorProtocol extends AbstractProtocol {
return executorService.schedule(() -> {
withLock(getProtocolName() + "::firingNextUpdate", () -> {
LOG.info("Updating asset " + attributeRef.getEntityId() + " for attribute " + attributeRef.getAttributeName() + " with value " + nextDatapoint.value.toString());
- updateLinkedAttribute(new AttributeState(attributeRef, nextDatapoint.value));
- replayMap.put(attributeRef, scheduleReplay(attributeRef, replaySimulatorElement));
+ try {
+ updateLinkedAttribute(new AttributeState(attributeRef, nextDatapoint.value));
+ } catch (Exception e) {
+ LOG.log(Level.SEVERE, "Exception thrown when updating value: %s", e);
+ } finally {
+ replayMap.put(attributeRef, scheduleReplay(attributeRef, replaySimulatorElement));
+ }
});
}, nextRunRelative, TimeUnit.SECONDS);
} catch (JsonProcessingException e) {