Fix NP found during optica re-route on multi-instance
Change-Id: Ia7d9c221b36e1224004273b3884b8d0385af086d
diff --git a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/HazelcastIntentBatchQueue.java b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/HazelcastIntentBatchQueue.java
index 6920089..3f52cd1 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/HazelcastIntentBatchQueue.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/HazelcastIntentBatchQueue.java
@@ -20,6 +20,7 @@
import static org.slf4j.LoggerFactory.getLogger;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import org.apache.felix.scr.annotations.Activate;
@@ -165,8 +166,14 @@
public void removeIntentOperations(IntentOperations ops) {
ApplicationId appId = ops.appId();
synchronized (this) {
- checkState(outstandingOps.get(appId).equals(ops),
- "Operations not found.");
+ IntentOperations outstanding = outstandingOps.get(appId);
+ if (outstanding != null) {
+ checkState(Objects.equals(ops, outstanding),
+ "Operation {} does not match outstanding operation {}",
+ ops, outstanding);
+ } else {
+ log.warn("Operation {} not found", ops);
+ }
SQueue<IntentOperations> queue = batchQueues.get(appId);
// TODO consider alternatives to remove
checkState(queue.remove().equals(ops),