From 6cec2b32fdd2a9976a8c6e9488608fc84664f16f Mon Sep 17 00:00:00 2001 From: Taka Cho Date: Wed, 17 Jun 2020 10:45:59 -0400 Subject: m2 sonar issues - unused import - logger format - Extract the assignment out of this expression - Replace this if-then-else statement by a single return statement Issue-ID: POLICY-2616 Change-Id: I2d04569a7070f79fc8979274bce2b87b4b2f3e24 Signed-off-by: Taka Cho --- .../java/org/onap/policy/drools/m2/lock/LockAdjunct.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'controlloop/m2/lock') 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(); } /*=================================*/ -- cgit 1.2.3-korg