From b959b7bdfb79d8267a862edb72ee6a6e867c4251 Mon Sep 17 00:00:00 2001 From: Sean Gilligan Date: Sun, 1 Oct 2023 10:36:46 -0700 Subject: [PATCH] KeyDerivationTasks: use `Thread.sleep()` instead of `Guava Uninterrruptables` We don't really need to sleep uninterrruptibly here. The code is only displaying a progress indicator and the `call()` method is already throwing `Exception`. --- .../java/org/bitcoinj/walletfx/utils/KeyDerivationTasks.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/wallettemplate/src/main/java/org/bitcoinj/walletfx/utils/KeyDerivationTasks.java b/wallettemplate/src/main/java/org/bitcoinj/walletfx/utils/KeyDerivationTasks.java index 677c05162..d45c1f3b9 100644 --- a/wallettemplate/src/main/java/org/bitcoinj/walletfx/utils/KeyDerivationTasks.java +++ b/wallettemplate/src/main/java/org/bitcoinj/walletfx/utils/KeyDerivationTasks.java @@ -18,7 +18,6 @@ package org.bitcoinj.walletfx.utils; import org.bitcoinj.crypto.AesKey; import org.bitcoinj.crypto.KeyCrypterScrypt; -import com.google.common.util.concurrent.Uninterruptibles; import javafx.beans.property.ReadOnlyDoubleProperty; import javafx.concurrent.Task; import org.slf4j.Logger; @@ -26,7 +25,6 @@ import org.slf4j.LoggerFactory; import javax.annotation.*; import java.time.Duration; -import java.util.concurrent.TimeUnit; import static org.bitcoinj.walletfx.utils.GuiUtils.checkGuiThread; @@ -78,7 +76,7 @@ public class KeyDerivationTasks { double progress = (curTime - startTime) / (double) targetTimeMillis; updateProgress(progress, 1.0); - Uninterruptibles.sleepUninterruptibly(PROGRESS_UPDATE_INTERVAL.toMillis(), TimeUnit.MILLISECONDS); + Thread.sleep(PROGRESS_UPDATE_INTERVAL.toMillis()); } // Wait for the encryption thread before switching back to main UI. updateProgress(1.0, 1.0);