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

chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new d216dc9  [FLINK-10186][streaming] Use ThreadLocalRandom in 
BufferSpiller constructor
d216dc9 is described below

commit d216dc9803750050e8c9d369ad468c5125119407
Author: Hiroaki Yoshida <[email protected]>
AuthorDate: Mon Sep 3 01:46:36 2018 -0700

    [FLINK-10186][streaming] Use ThreadLocalRandom in BufferSpiller constructor
---
 .../java/org/apache/flink/streaming/runtime/io/BufferSpiller.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BufferSpiller.java
 
b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BufferSpiller.java
index 7a0be33..4b690d1 100644
--- 
a/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BufferSpiller.java
+++ 
b/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BufferSpiller.java
@@ -35,7 +35,7 @@ import java.io.RandomAccessFile;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.nio.channels.FileChannel;
-import java.util.Random;
+import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.atomic.AtomicInteger;
 
 /**
@@ -115,7 +115,7 @@ public class BufferSpiller implements BufferBlocker {
                this.tempDir = tempDirs[DIRECTORY_INDEX.getAndIncrement() % 
tempDirs.length];
 
                byte[] rndBytes = new byte[32];
-               new Random().nextBytes(rndBytes);
+               ThreadLocalRandom.current().nextBytes(rndBytes);
                this.spillFilePrefix = StringUtils.byteToHexString(rndBytes) + 
'.';
 
                // prepare for first contents

Reply via email to