You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2019/09/10 11:09:57 UTC

[commons-rng] branch master updated: Make method explicitly synchronized to match parent class implementation.

This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git


The following commit(s) were added to refs/heads/master by this push:
     new cd666e2  Make method explicitly synchronized to match parent class implementation.
cd666e2 is described below

commit cd666e2b720c1b91a88274a5080126f760ca02a3
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Tue Sep 10 13:03:51 2019 +0200

    Make method explicitly synchronized to match parent class implementation.
    
    Fix suggested by SonarQube.
---
 .../org/apache/commons/rng/simple/JDKRandomBridge.java   | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/JDKRandomBridge.java b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/JDKRandomBridge.java
index aa13a25..78fc60b 100644
--- a/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/JDKRandomBridge.java
+++ b/commons-rng-simple/src/main/java/org/apache/commons/rng/simple/JDKRandomBridge.java
@@ -65,16 +65,14 @@ public final class JDKRandomBridge extends Random {
 
     /** {@inheritDoc} */
     @Override
-    public void setSeed(long seed) {
-        synchronized (this) {
-            if (isInitialized) {
-                delegate = RandomSource.create(source, seed);
+    public synchronized void setSeed(long seed) {
+        if (isInitialized) {
+            delegate = RandomSource.create(source, seed);
 
-                // Force the clearing of the "haveNextNextGaussian" flag
-                // (cf. Javadoc of the base class); the value passed here
-                // is irrelevant (since it will not be used).
-                super.setSeed(0L);
-            }
+            // Force the clearing of the "haveNextNextGaussian" flag
+            // (cf. Javadoc of the base class); the value passed here
+            // is irrelevant (since it will not be used).
+            super.setSeed(0L);
         }
     }