100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Removed unnecessary use of global lock
Rich Turner43545bc413e0
diff --git a/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.javaindex 097cb418f..84ffde92a 100644--- a/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/AbstractProtocol.java@@ -345,25 +345,23 @@ public abstract class AbstractProtocol implements Protocol {* {@link #doInboundValueProcessing} before sending on the sensor queue.*/final protected void updateLinkedAttribute(final AttributeState state, long timestamp) {- withLock(getProtocolName() + "::updateLinkedAttribute", () -> {- AssetAttribute attribute = linkedAttributes.get(state.getAttributeRef());+ AssetAttribute attribute = linkedAttributes.get(state.getAttributeRef());- if (attribute == null) {- LOG.severe("Update linked attribute called for un-linked attribute: " + state);- return;- }+ if (attribute == null) {+ LOG.severe("Update linked attribute called for un-linked attribute: " + state);+ return;+ }- Pair<Boolean, Value> ignoreAndConverted = Protocol.doInboundValueProcessing(attribute, state.getValue().orElse(null), assetService);+ Pair<Boolean, Value> ignoreAndConverted = Protocol.doInboundValueProcessing(attribute, state.getValue().orElse(null), assetService);- if (ignoreAndConverted.key) {- LOG.fine("Value conversion returned ignore so attribute will not be updated: " + attribute.getReferenceOrThrow());- return;- }+ if (ignoreAndConverted.key) {+ LOG.fine("Value conversion returned ignore so attribute will not be updated: " + attribute.getReferenceOrThrow());+ return;+ }- AttributeEvent attributeEvent = new AttributeEvent(new AttributeState(attribute.getReferenceOrThrow(), ignoreAndConverted.value), timestamp);- LOG.fine("Sending on sensor queue: " + attributeEvent);- producerTemplate.sendBodyAndHeader(SENSOR_QUEUE, attributeEvent, Protocol.SENSOR_QUEUE_SOURCE_PROTOCOL, getProtocolName());- });+ AttributeEvent attributeEvent = new AttributeEvent(new AttributeState(attribute.getReferenceOrThrow(), ignoreAndConverted.value), timestamp);+ LOG.fine("Sending on sensor queue: " + attributeEvent);+ producerTemplate.sendBodyAndHeader(SENSOR_QUEUE, attributeEvent, Protocol.SENSOR_QUEUE_SOURCE_PROTOCOL, getProtocolName());}/**