Fix NP found during optica re-route on multi-instance
Change-Id: Ia7d9c221b36e1224004273b3884b8d0385af086d
Showing
1 changed file
with
9 additions
and
2 deletions
... | @@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkState; | ... | @@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkState; |
20 | import static org.slf4j.LoggerFactory.getLogger; | 20 | import static org.slf4j.LoggerFactory.getLogger; |
21 | 21 | ||
22 | import java.util.Map; | 22 | import java.util.Map; |
23 | +import java.util.Objects; | ||
23 | import java.util.Set; | 24 | import java.util.Set; |
24 | 25 | ||
25 | import org.apache.felix.scr.annotations.Activate; | 26 | import org.apache.felix.scr.annotations.Activate; |
... | @@ -165,8 +166,14 @@ public class HazelcastIntentBatchQueue | ... | @@ -165,8 +166,14 @@ public class HazelcastIntentBatchQueue |
165 | public void removeIntentOperations(IntentOperations ops) { | 166 | public void removeIntentOperations(IntentOperations ops) { |
166 | ApplicationId appId = ops.appId(); | 167 | ApplicationId appId = ops.appId(); |
167 | synchronized (this) { | 168 | synchronized (this) { |
168 | - checkState(outstandingOps.get(appId).equals(ops), | 169 | + IntentOperations outstanding = outstandingOps.get(appId); |
169 | - "Operations not found."); | 170 | + if (outstanding != null) { |
171 | + checkState(Objects.equals(ops, outstanding), | ||
172 | + "Operation {} does not match outstanding operation {}", | ||
173 | + ops, outstanding); | ||
174 | + } else { | ||
175 | + log.warn("Operation {} not found", ops); | ||
176 | + } | ||
170 | SQueue<IntentOperations> queue = batchQueues.get(appId); | 177 | SQueue<IntentOperations> queue = batchQueues.get(appId); |
171 | // TODO consider alternatives to remove | 178 | // TODO consider alternatives to remove |
172 | checkState(queue.remove().equals(ops), | 179 | checkState(queue.remove().equals(ops), | ... | ... |
-
Please register or login to post a comment