You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2018/12/27 10:01:29 UTC

[13/20] tomee git commit: use ThreadLocalRandom

use ThreadLocalRandom


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/6450b2b4
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/6450b2b4
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/6450b2b4

Branch: refs/heads/master
Commit: 6450b2b4b68c0bc06a7e32ebcc80573aa71be69a
Parents: 40dc320
Author: Hayri Cicek <ha...@kodnito.com>
Authored: Mon Dec 10 13:32:27 2018 +0100
Committer: Hayri Cicek <ha...@kodnito.com>
Committed: Mon Dec 10 13:32:27 2018 +0100

----------------------------------------------------------------------
 .../src/main/java/org/apache/openejb/loader/FileUtils.java      | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/6450b2b4/container/openejb-loader/src/main/java/org/apache/openejb/loader/FileUtils.java
----------------------------------------------------------------------
diff --git a/container/openejb-loader/src/main/java/org/apache/openejb/loader/FileUtils.java b/container/openejb-loader/src/main/java/org/apache/openejb/loader/FileUtils.java
index 747f7c8..f6f15cd 100644
--- a/container/openejb-loader/src/main/java/org/apache/openejb/loader/FileUtils.java
+++ b/container/openejb-loader/src/main/java/org/apache/openejb/loader/FileUtils.java
@@ -20,12 +20,11 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.Hashtable;
+import java.util.concurrent.ThreadLocalRandom;
 
 @SuppressWarnings("PMD.OverrideBothEqualsAndHashcode")
 public class FileUtils {
 
-    private static final java.util.Random RANDOM = new java.util.Random();
-
     private File home;
 
     private FileUtils(final String homeDir, final String defaultDir) {
@@ -165,7 +164,7 @@ public class FileUtils {
     public static File createTempDirectory(final String pathPrefix) throws IOException {
         for (int maxAttempts = 100; maxAttempts > 0; --maxAttempts) {
 
-            final String path = pathPrefix + RANDOM.nextLong();
+            final String path = pathPrefix + ThreadLocalRandom.current().nextLong();
             final File tmpDir = new File(path);
 
             if (!tmpDir.exists() && tmpDir.mkdirs()) {