From e20e23dbc502a74e6c20f01f65b091b57a84a35d Mon Sep 17 00:00:00 2001 From: woodser Date: Sat, 26 Nov 2022 17:23:11 +0000 Subject: [PATCH] stop initializing trades on shutdown --- core/src/main/java/bisq/core/trade/TradeManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/src/main/java/bisq/core/trade/TradeManager.java b/core/src/main/java/bisq/core/trade/TradeManager.java index 6ed9992695..a1d500d584 100644 --- a/core/src/main/java/bisq/core/trade/TradeManager.java +++ b/core/src/main/java/bisq/core/trade/TradeManager.java @@ -118,6 +118,7 @@ import monero.wallet.model.MoneroOutputQuery; public class TradeManager implements PersistedDataHost, DecryptedDirectMessageListener { private static final Logger log = LoggerFactory.getLogger(TradeManager.class); + private boolean isShutDown; private final User user; @Getter private final KeyRing keyRing; @@ -271,6 +272,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi } public void shutDown() { + isShutDown = true; // collect trades to shutdown Set trades = new HashSet(); @@ -360,6 +362,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi HavenoUtils.executeTasks(tasks, threadPoolSize); // reset any available address entries + if (isShutDown) return; xmrWalletService.getAddressEntriesForAvailableBalanceStream() .filter(addressEntry -> addressEntry.getOfferId() != null) .forEach(addressEntry -> { @@ -378,6 +381,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi } private void initPersistedTrade(Trade trade) { + if (isShutDown) return; initTradeAndProtocol(trade, getTradeProtocol(trade)); requestPersistence(); }