ScryptUtil: Fix thread leak

Each time someone called the static method
ScryptUtil.deriveKeyWithScrypt(...) a new worker pool was created. The
worker pool was never shutdown.
This commit is contained in:
Alva Swanson 2023-02-05 13:31:15 +01:00
parent e25c27ec99
commit 5506443d54
No known key found for this signature in database
GPG key ID: 004760E77F753090

View file

@ -18,7 +18,6 @@
package bisq.core.crypto;
import bisq.common.UserThread;
import bisq.common.util.Utilities;
import com.google.protobuf.ByteString;
@ -49,7 +48,7 @@ public class ScryptUtil {
}
public static void deriveKeyWithScrypt(KeyCrypterScrypt keyCrypterScrypt, String password, DeriveKeyResultHandler resultHandler) {
Utilities.getThreadPoolExecutor("ScryptUtil:deriveKeyWithScrypt", 1, 2, 5L).submit(() -> {
new Thread(() -> {
try {
log.debug("Doing key derivation");
long start = System.currentTimeMillis();
@ -70,6 +69,6 @@ public class ScryptUtil {
log.error("Executing task failed. " + t.getMessage());
throw t;
}
});
}, "ScryptUtil:deriveKeyWithScrypt").start();
}
}