ONOS-7896 Fix a bug that results in flow obj queue not being dequeued properly

The bug is introduced in 20858

Change-Id: I601aa5b2cfecb61064204b1d071e5e052d4f0410
diff --git a/core/net/src/main/java/org/onosproject/net/flowobjective/impl/InOrderFlowObjectiveManager.java b/core/net/src/main/java/org/onosproject/net/flowobjective/impl/InOrderFlowObjectiveManager.java
index 4f8404b..f9cc9bf 100644
--- a/core/net/src/main/java/org/onosproject/net/flowobjective/impl/InOrderFlowObjectiveManager.java
+++ b/core/net/src/main/java/org/onosproject/net/flowobjective/impl/InOrderFlowObjectiveManager.java
@@ -423,21 +423,21 @@
     final class InOrderObjectiveContext implements ObjectiveContext {
         private final DeviceId deviceId;
         private final ObjectiveContext originalContext;
-        // Prevent context from being executed multiple times.
-        // E.g. when the context actually succeed after the cache timeout
-        private final AtomicBoolean done;
+        // Prevent onSuccess from being executed after onError is called
+        // i.e. when the context actually succeed after the cache timeout
+        private final AtomicBoolean failed;
 
         InOrderObjectiveContext(DeviceId deviceId, ObjectiveContext originalContext) {
             this.deviceId = deviceId;
             this.originalContext = originalContext;
-            this.done = new AtomicBoolean(false);
+            this.failed = new AtomicBoolean(false);
         }
 
         @Override
         public void onSuccess(Objective objective) {
             log.trace("Flow objective onSuccess {}", objective);
 
-            if (!done.getAndSet(true)) {
+            if (!failed.get()) {
                 dequeue(deviceId, objective, null);
                 if (originalContext != null) {
                     originalContext.onSuccess(objective);
@@ -449,7 +449,7 @@
         public void onError(Objective objective, ObjectiveError error) {
             log.warn("Flow objective onError {}. Reason = {}", objective, error);
 
-            if (!done.getAndSet(true)) {
+            if (!failed.getAndSet(true)) {
                 dequeue(deviceId, objective, error);
                 if (originalContext != null) {
                     originalContext.onError(objective, error);