aboutsummaryrefslogtreecommitdiffstats
path: root/policy-core/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-04-08 10:46:40 -0400
committerJim Hahn <jrh3@att.com>2020-04-08 10:58:48 -0400
commit18c81f810f26f57196c0a2ebcbd911a2f822c1db (patch)
treeff571bcce6c69affd9acaefe5f92e496ee57a34f /policy-core/src
parent277036656448dbfd2cfe310e43d0a0b713504aea (diff)
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 <jrh3@att.com>
Diffstat (limited to 'policy-core/src')
-rw-r--r--policy-core/src/main/java/org/onap/policy/drools/core/lock/LockImpl.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/lock/LockImpl.java b/policy-core/src/main/java/org/onap/policy/drools/core/lock/LockImpl.java
index 9596dbe8..8866eb82 100644
--- a/policy-core/src/main/java/org/onap/policy/drools/core/lock/LockImpl.java
+++ b/policy-core/src/main/java/org/onap/policy/drools/core/lock/LockImpl.java
@@ -100,13 +100,15 @@ public class LockImpl implements Lock, Serializable {
* This method always succeeds, unless the lock is already unavailable.
*/
@Override
- public synchronized boolean free() {
- if (isUnavailable()) {
- return false;
- }
+ public boolean free() {
+ synchronized (this) {
+ if (isUnavailable()) {
+ return false;
+ }
- logger.info("releasing lock: {}", this);
- setState(LockState.UNAVAILABLE);
+ logger.info("releasing lock: {}", this);
+ setState(LockState.UNAVAILABLE);
+ }
return true;
}