glasser commented on a change in pull request #6226: Prohibit some Random usage
patterns
URL: https://github.com/apache/incubator-druid/pull/6226#discussion_r228649290
##########
File path:
indexing-service/src/main/java/org/apache/druid/indexing/common/task/RealtimeIndexTask.java
##########
@@ -76,34 +76,43 @@
import java.io.File;
import java.io.IOException;
import java.util.Map;
-import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ThreadLocalRandom;
public class RealtimeIndexTask extends AbstractTask
{
public static final String CTX_KEY_LOOKUP_TIER = "lookupTier";
private static final EmittingLogger log = new
EmittingLogger(RealtimeIndexTask.class);
- private static final Random random = new Random();
+
+ private static final int TASK_ID_BITS_PER_SYMBOL = 4;
+ private static final int TASK_ID_SYMBOL_MASK = (1 <<
TASK_ID_BITS_PER_SYMBOL) - 1;
+ private static final int TASK_ID_LENGTH = Integer.BYTES /
TASK_ID_BITS_PER_SYMBOL;
Review comment:
I guess that'll teach me to run off of a random commit on master :)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]