diff options
Diffstat (limited to 'lib/rlock/src')
3 files changed, 5 insertions, 1 deletions
diff --git a/lib/rlock/src/main/java/org/onap/ccsdk/features/lib/rlock/LockHelperImpl.java b/lib/rlock/src/main/java/org/onap/ccsdk/features/lib/rlock/LockHelperImpl.java index 63fe111df..a63b7d481 100644 --- a/lib/rlock/src/main/java/org/onap/ccsdk/features/lib/rlock/LockHelperImpl.java +++ b/lib/rlock/src/main/java/org/onap/ccsdk/features/lib/rlock/LockHelperImpl.java @@ -84,6 +84,7 @@ public class LockHelperImpl implements LockHelper { try { Thread.sleep(lockWait * 1000L); } catch (InterruptedException ex) { + Thread.currentThread().interrupt(); } } } diff --git a/lib/rlock/src/main/java/org/onap/ccsdk/features/lib/rlock/SynchronizedFunction.java b/lib/rlock/src/main/java/org/onap/ccsdk/features/lib/rlock/SynchronizedFunction.java index e92700055..419977890 100644 --- a/lib/rlock/src/main/java/org/onap/ccsdk/features/lib/rlock/SynchronizedFunction.java +++ b/lib/rlock/src/main/java/org/onap/ccsdk/features/lib/rlock/SynchronizedFunction.java @@ -1,5 +1,6 @@ package org.onap.ccsdk.features.lib.rlock; +import java.security.SecureRandom; import java.util.Collection; import java.util.HashSet; import java.util.Set; @@ -99,6 +100,7 @@ public abstract class SynchronizedFunction { } private static String generateLockRequester() { - return "SynchronizedFunction-" + (int) (Math.random() * 1000000); + SecureRandom random = new SecureRandom(); + return "SynchronizedFunction-" + (random.nextInt() % 1000000); } } diff --git a/lib/rlock/src/test/java/org/onap/ccsdk/features/lib/rlock/TestLockHelper.java b/lib/rlock/src/test/java/org/onap/ccsdk/features/lib/rlock/TestLockHelper.java index cce377e2c..4f205d16d 100644 --- a/lib/rlock/src/test/java/org/onap/ccsdk/features/lib/rlock/TestLockHelper.java +++ b/lib/rlock/src/test/java/org/onap/ccsdk/features/lib/rlock/TestLockHelper.java @@ -42,6 +42,7 @@ public class TestLockHelper { try { Thread.sleep(500); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); log.warn("Thread interrupted: " + e.getMessage(), e); } |