You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by dr...@apache.org on 2017/04/11 14:24:09 UTC

[1/2] brooklyn-server git commit: Allow setting random number generator seed for identifiers

Repository: brooklyn-server
Updated Branches:
  refs/heads/master d9a8c1df5 -> c56932034


Allow setting random number generator seed for identifiers


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/b7244740
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/b7244740
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/b7244740

Branch: refs/heads/master
Commit: b7244740fc6b75bdf3be4191a3ed99965eaab9bc
Parents: 9557540
Author: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Authored: Sun Apr 9 17:50:36 2017 +0100
Committer: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Committed: Tue Apr 11 14:02:38 2017 +0100

----------------------------------------------------------------------
 .../org/apache/brooklyn/util/text/Identifiers.java     | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b7244740/utils/common/src/main/java/org/apache/brooklyn/util/text/Identifiers.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/text/Identifiers.java b/utils/common/src/main/java/org/apache/brooklyn/util/text/Identifiers.java
index 56af6cf..b8a9225 100644
--- a/utils/common/src/main/java/org/apache/brooklyn/util/text/Identifiers.java
+++ b/utils/common/src/main/java/org/apache/brooklyn/util/text/Identifiers.java
@@ -32,8 +32,6 @@ import com.google.common.base.Preconditions;
 import com.google.common.primitives.Chars;
 
 public class Identifiers {
-    
-    private static Random random = new Random();
 
     public static final String UPPER_CASE_ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
     public static final String LOWER_CASE_ALPHA = "abcdefghijklmnopqrstuvwxyz";
@@ -68,6 +66,17 @@ public class Identifiers {
     // We only create a secure random when it is first used
     private static Random secureRandom = null;
 
+    private static Random random = null;
+
+    static {
+        Long seed = Long.getLong("brooklyn.experimental.feature.random_seed");
+        if (seed != null) {
+            random = new Random(seed);
+        } else {
+            random = new Random();
+        }
+    }
+
     /** makes a random id string (letters and numbers) of the given length;
      * starts with letter (upper or lower) so can be used as java-id;
      * tests ensure random distribution, so random ID of length 5 


[2/2] brooklyn-server git commit: This closes #628

Posted by dr...@apache.org.
This closes #628


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/c5693203
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/c5693203
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/c5693203

Branch: refs/heads/master
Commit: c569320347c0273b71bd071374148abb03f200ba
Parents: d9a8c1d b724474
Author: Duncan Godwin <dr...@googlemail.com>
Authored: Tue Apr 11 15:24:03 2017 +0100
Committer: Duncan Godwin <dr...@googlemail.com>
Committed: Tue Apr 11 15:24:03 2017 +0100

----------------------------------------------------------------------
 .../org/apache/brooklyn/util/text/Identifiers.java     | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------