aboutsummaryrefslogtreecommitdiffstats
path: root/feature-distributed-locking/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2018-04-12 14:23:25 -0400
committerJim Hahn <jrh3@att.com>2018-04-12 14:43:20 -0400
commit3fd9dc0e5c584702d25982172bb5ee44b6b57aa3 (patch)
tree9147575007cccbdfc2e362582450cf8bb6d923f3 /feature-distributed-locking/src/main
parent3896977ef55d562b3cee71a8298b2ad8c57ffad5 (diff)
Sonar fixes for policy-core locks
Made a number of changes to the locking code in policy-core, to address sonar issues. This entaileed changing some of the Lock API methods to return OperResult instead of Boolean. Updated distributed locking with the new API return types. Simplified Thread creation using functional methods. Change-Id: If32bf7a435d2aedb969de1b77c7e7e27e110ecb0 Issue-ID: POLICY-728 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'feature-distributed-locking/src/main')
-rw-r--r--feature-distributed-locking/src/main/java/org/onap/policy/distributed/locking/DistributedLockingFeature.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/feature-distributed-locking/src/main/java/org/onap/policy/distributed/locking/DistributedLockingFeature.java b/feature-distributed-locking/src/main/java/org/onap/policy/distributed/locking/DistributedLockingFeature.java
index 7906dba7..5994beb6 100644
--- a/feature-distributed-locking/src/main/java/org/onap/policy/distributed/locking/DistributedLockingFeature.java
+++ b/feature-distributed-locking/src/main/java/org/onap/policy/distributed/locking/DistributedLockingFeature.java
@@ -86,24 +86,24 @@ public class DistributedLockingFeature implements PolicyEngineFeatureAPI, Policy
}
@Override
- public Boolean beforeUnlock(String resourceId, String owner) {
+ public OperResult beforeUnlock(String resourceId, String owner) {
TargetLock tLock = new TargetLock(resourceId, uuid, owner, lockProps);
- return tLock.unlock();
+ return(tLock.unlock() ? OperResult.OPER_ACCEPTED : OperResult.OPER_DENIED);
}
@Override
- public Boolean beforeIsLockedBy(String resourceId, String owner) {
+ public OperResult beforeIsLockedBy(String resourceId, String owner) {
TargetLock tLock = new TargetLock(resourceId, uuid, owner, lockProps);
-
- return tLock.isActive();
+
+ return(tLock.isActive() ? OperResult.OPER_ACCEPTED : OperResult.OPER_DENIED);
}
@Override
- public Boolean beforeIsLocked(String resourceId) {
+ public OperResult beforeIsLocked(String resourceId) {
TargetLock tLock = new TargetLock(resourceId, uuid, "dummyOwner", lockProps);
-
- return tLock.isLocked();
+
+ return(tLock.isLocked() ? OperResult.OPER_ACCEPTED : OperResult.OPER_DENIED);
}
@Override