From cdf96f32a2c298ce2efb9c2edf4033c425db96f1 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Sun, 17 Oct 2021 15:06:32 +0100 Subject: [PATCH] switch to WeakHashMap to prevent reference leak of Destinations --- .../main/groovy/com/muwire/core/connection/I2PConnector.groovy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/src/main/groovy/com/muwire/core/connection/I2PConnector.groovy b/core/src/main/groovy/com/muwire/core/connection/I2PConnector.groovy index dd7c499a..6d538411 100644 --- a/core/src/main/groovy/com/muwire/core/connection/I2PConnector.groovy +++ b/core/src/main/groovy/com/muwire/core/connection/I2PConnector.groovy @@ -3,7 +3,6 @@ package com.muwire.core.connection import net.i2p.client.streaming.I2PSocketManager import net.i2p.data.Destination -import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.Semaphore class I2PConnector { @@ -12,7 +11,7 @@ class I2PConnector { final I2PSocketManager socketManager - private final Map limiter = new ConcurrentHashMap<>() + private final Map limiter = Collections.synchronizedMap(new WeakHashMap<>()) I2PConnector() {}