From 18c81f810f26f57196c0a2ebcbd911a2f822c1db Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Wed, 8 Apr 2020 10:46:40 -0400 Subject: Address more sonar issues in drools-pdp Addressed the following sonar issues: - use of "synchronized" - use Files.delete() instead of File.delete() Issue-ID: POLICY-2305 Change-Id: Id55628fe12d9d764616e57321382a70cb5704ba1 Signed-off-by: Jim Hahn --- .../java/org/onap/policy/drools/system/internal/FeatureLockImpl.java | 4 ++-- .../org/onap/policy/drools/system/internal/SimpleLockManager.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'policy-management/src/main/java/org/onap') diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/internal/FeatureLockImpl.java b/policy-management/src/main/java/org/onap/policy/drools/system/internal/FeatureLockImpl.java index 6b0c8a43..799cca7b 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/internal/FeatureLockImpl.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/internal/FeatureLockImpl.java @@ -119,7 +119,7 @@ public abstract class FeatureLockImpl extends LockImpl { * @return {@code true} if the lock can be freed, {@code false} if the lock is * unavailable */ - protected boolean freeAllowed() { + protected synchronized boolean freeAllowed() { // do a quick check of the state if (isUnavailable()) { return false; @@ -150,7 +150,7 @@ public abstract class FeatureLockImpl extends LockImpl { * @return {@code true} if the lock can be extended, {@code false} if the lock is * unavailable */ - protected boolean extendAllowed(int holdSec, LockCallback callback) { + protected synchronized boolean extendAllowed(int holdSec, LockCallback callback) { if (holdSec < 0) { throw new IllegalArgumentException("holdSec is negative"); } diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/internal/SimpleLockManager.java b/policy-management/src/main/java/org/onap/policy/drools/system/internal/SimpleLockManager.java index 1df139e2..c2c921f5 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/internal/SimpleLockManager.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/internal/SimpleLockManager.java @@ -227,7 +227,7 @@ public class SimpleLockManager extends LockManager } @Override - public synchronized boolean free() { + public boolean free() { if (!freeAllowed()) { return false; } -- cgit 1.2.3-korg