Log the time taken for generating the initialSeedUniquifier
- Sometimes useful to know it how long it takes from the log, to make sure it's not something else that is blocking.
This commit is contained in:
parent
cde7157c39
commit
11fdec3c4a
@ -156,6 +156,7 @@ public final class ThreadLocalRandom extends Random {
|
||||
}
|
||||
|
||||
private static long newSeed() {
|
||||
final long startTime = System.nanoTime();
|
||||
for (;;) {
|
||||
final long current = seedUniquifier.get();
|
||||
final long actualCurrent = current != 0? current : getInitialSeedUniquifier();
|
||||
@ -165,7 +166,9 @@ public final class ThreadLocalRandom extends Random {
|
||||
|
||||
if (seedUniquifier.compareAndSet(current, next)) {
|
||||
if (current == 0 && logger.isDebugEnabled()) {
|
||||
logger.debug(String.format("-Dio.netty.initialSeedUniquifier: 0x%016x", actualCurrent));
|
||||
logger.debug(String.format(
|
||||
"-Dio.netty.initialSeedUniquifier: 0x%016x (took %d ms)",
|
||||
actualCurrent, TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime)));
|
||||
}
|
||||
return next ^ System.nanoTime();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user