Skip to content

Commit

Permalink
[UNDERTOW-2385] Modify ThreadLocalCache using WeakHashMap
Browse files Browse the repository at this point in the history
  • Loading branch information
corby kim authored and fl4via committed Jun 21, 2024
1 parent 3d0ef69 commit 9542604
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import java.nio.ByteBuffer;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;

Expand Down Expand Up @@ -334,7 +334,7 @@ protected void finalize() throws Throwable {
// class can be called by a different thread than the one that initialized the data.
private static class ThreadLocalCache {

Map<Thread, ThreadLocalData> localsByThread = new HashMap<>();
Map<Thread, ThreadLocalData> localsByThread = new WeakHashMap<>();

ThreadLocalData get() {
return localsByThread.get(Thread.currentThread());
Expand Down

0 comments on commit 9542604

Please sign in to comment.