aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/m2
diff options
context:
space:
mode:
authorRam Krishna Verma <ram_krishna.verma@bell.ca>2020-06-17 21:24:50 +0000
committerGerrit Code Review <gerrit@onap.org>2020-06-17 21:24:50 +0000
commitcaab720c00cafe17458d0d1913a9bfb8012d3c76 (patch)
tree1cf9f0f595485d20b4f3a8de2e9fdf27122a0b46 /controlloop/m2
parent8dc6c5b438a822af58aefd676834b6208d6f74fd (diff)
parent6cec2b32fdd2a9976a8c6e9488608fc84664f16f (diff)
Merge "m2 sonar issues"
Diffstat (limited to 'controlloop/m2')
-rw-r--r--controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java10
-rw-r--r--controlloop/m2/lock/src/main/java/org/onap/policy/drools/m2/lock/LockAdjunct.java13
2 files changed, 7 insertions, 16 deletions
diff --git a/controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java b/controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java
index a0d159150..1bfb6ae4c 100644
--- a/controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java
+++ b/controlloop/m2/guard/src/main/java/org/onap/policy/guard/GuardContext.java
@@ -27,19 +27,15 @@ import java.time.Instant;
import java.util.HashMap;
import java.util.Properties;
import java.util.UUID;
-import java.util.function.Supplier;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.drools.core.WorkingMemory;
-import org.onap.policy.drools.controller.DroolsController;
import org.onap.policy.drools.core.PolicyContainer;
import org.onap.policy.drools.core.PolicySession;
import org.onap.policy.drools.system.PolicyController;
import org.onap.policy.drools.system.PolicyControllerConstants;
import org.onap.policy.drools.system.PolicyEngineConstants;
-import org.onap.policy.guard.OperationsHistory;
-import org.onap.policy.guard.Util;
import org.onap.policy.util.DroolsSessionCommonSerializable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -177,7 +173,7 @@ public class GuardContext implements Serializable {
sb.setLength(sb.length() - 2);
errorMessage = sb.toString();
disabled = true;
- logger.error("Initialization failure: " + errorMessage);
+ logger.error("Initialization failure: {}", errorMessage);
}
}
@@ -301,7 +297,7 @@ public class GuardContext implements Serializable {
if (disabled) {
if (errorMessage != null) {
- logger.error("Database update skipped: " + errorMessage);
+ logger.error("Database update skipped: {}", errorMessage);
}
return false;
}
@@ -366,7 +362,7 @@ public class GuardContext implements Serializable {
final String message, final String outcome) {
if (disabled) {
if (errorMessage != null) {
- logger.error("Database update skipped: " + errorMessage);
+ logger.error("Database update skipped: {}", errorMessage);
}
return;
}
diff --git a/controlloop/m2/lock/src/main/java/org/onap/policy/drools/m2/lock/LockAdjunct.java b/controlloop/m2/lock/src/main/java/org/onap/policy/drools/m2/lock/LockAdjunct.java
index e81ab6288..98d82876e 100644
--- a/controlloop/m2/lock/src/main/java/org/onap/policy/drools/m2/lock/LockAdjunct.java
+++ b/controlloop/m2/lock/src/main/java/org/onap/policy/drools/m2/lock/LockAdjunct.java
@@ -21,7 +21,6 @@
package org.onap.policy.drools.m2.lock;
import java.io.Serializable;
-import java.util.HashMap;
import org.onap.policy.drools.core.lock.Lock;
import org.onap.policy.drools.core.lock.LockCallback;
@@ -103,14 +102,10 @@ public class LockAdjunct implements Transaction.Adjunct, LockCallback,
this.requestor = requestor;
// try to allocate a new lock
- if ((lock = PolicyEngineConstants.getManager().createLock(
- key, ownerKey, 600, this, waitForLock)).isActive()) {
- // the lock is good
- return true;
- }
-
- // we need to wait for the lock -- return false,
- return false;
+ lock = PolicyEngineConstants.getManager().createLock(
+ key, ownerKey, 600, this, waitForLock);
+ // return the boolean value of the lock.isactive
+ return lock.isActive();
}
/*=================================*/