[ONOS-7565] Flow rules error while rerouting intents with Flow Objectives
Change-Id: I785e2e82cabda23b07816e572ccfde4bed45a3f2
diff --git a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/ECFlowRuleStore.java b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/ECFlowRuleStore.java
index 108f380..f998dad 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/ECFlowRuleStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/ECFlowRuleStore.java
@@ -837,11 +837,11 @@
}
public void add(FlowEntry rule) {
- StoredFlowEntry stored = getFlowEntriesInternal(rule.deviceId(), rule.id())
- .putIfAbsent((StoredFlowEntry) rule, (StoredFlowEntry) rule);
- if (stored == null) {
- lastUpdateTimes.put(rule.deviceId(), System.currentTimeMillis());
- }
+ getFlowEntriesInternal(rule.deviceId(), rule.id())
+ .compute((StoredFlowEntry) rule, (k, stored) -> {
+ return (StoredFlowEntry) rule;
+ });
+ lastUpdateTimes.put(rule.deviceId(), System.currentTimeMillis());
}
public void update(FlowEntry rule) {