Do not read bridge node multiple times
[ovsdb.git] / southbound / southbound-impl / src / main / java / org / opendaylight / ovsdb / southbound / ovsdb / transact / QosUpdateCommand.java
index 339506416605c33ea6e71b0ee7637f119fb2050a..bd4ffadbf9d04263a6cbc5dd0767e2dae9ec6e70 100644 (file)
@@ -64,11 +64,12 @@ public class QosUpdateCommand implements TransactCommand {
         for (Entry<InstanceIdentifier<QosEntries>, QosEntries> qosMapEntry: createdOrUpdated.entrySet()) {
             InstanceIdentifier<OvsdbNodeAugmentation> iid =
                     qosMapEntry.getKey().firstIdentifierOf(OvsdbNodeAugmentation.class);
-            if (!state.getBridgeNode(iid).isPresent()) {
+            final var optBridgeNode = state.getBridgeNode(iid);
+            if (optBridgeNode.isEmpty()) {
                 return;
             }
-            OvsdbNodeAugmentation operNode =
-                state.getBridgeNode(iid).orElseThrow().augmentation(OvsdbNodeAugmentation.class);
+
+            OvsdbNodeAugmentation operNode = optBridgeNode.orElseThrow().augmentation(OvsdbNodeAugmentation.class);
 
             QosEntries qosEntry = qosMapEntry.getValue();
             Qos qos = transaction.getTypedRowWrapper(Qos.class);