summaryrefslogtreecommitdiffstats
path: root/controlloop/common
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java14
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java2
2 files changed, 9 insertions, 7 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
index 5f36bcc20..4817bec40 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
@@ -486,12 +486,14 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
if (this.targetLock == null) {
return null;
}
- if (PolicyGuard.unlockTarget(this.targetLock)) {
- TargetLock returnLock = this.targetLock;
- this.targetLock = null;
- return returnLock;
- }
- return null;
+
+ TargetLock returnLock = this.targetLock;
+ this.targetLock = null;
+
+ PolicyGuard.unlockTarget(returnLock);
+
+ // always return the old target lock so rules can retract it
+ return returnLock;
}
public enum NEW_EVENT_STATUS {
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
index 1af4a312d..02dda2048 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
@@ -768,7 +768,7 @@ public class ControlLoopEventManagerTest {
lockLock = manager.lockCurrentOperation();
assertNotNull(lockLock);
PolicyGuard.unlockTarget(lockLock.getB());
- assertNull(manager.unlockCurrentOperation());
+ assertEquals(lockLock.getB(), manager.unlockCurrentOperation());
clom.startOperation(event);