Skip to content

Commit 0e436dd

Browse files
authored
Use PlatformDependent.threadLocalRandom() to reduce memory footprint (#13977)
Motivation: Direct use of `io.netty.util.internal.ThreadLocalRandom` and `j.u.c.ThreadLocalRandom` could cause a lot of memory waste. Modifications: Use `PlatformDependent.threadLocalRandom()`. Result: Reduced Memory footprint.
1 parent 4d961d0 commit 0e436dd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

resolver-dns/src/main/java/io/netty/resolver/dns/DnsQueryIdSpace.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import io.netty.util.internal.MathUtil;
1919
import io.netty.util.internal.PlatformDependent;
20-
import io.netty.util.internal.ThreadLocalRandom;
2120

2221
import java.util.Random;
2322

@@ -62,7 +61,7 @@ int nextId() {
6261
}
6362
} else if (freeIdx == -1 ||
6463
// Let's make it somehow random which free slot is used.
65-
ThreadLocalRandom.current().nextBoolean()) {
64+
PlatformDependent.threadLocalRandom().nextBoolean()) {
6665
// We have a slot that we can use to create a new bucket if we need to.
6766
freeIdx = bucketIdx;
6867
}

0 commit comments

Comments
 (0)