From 0c3761b1727121ab453379810025a52becbb2ee1 Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 20 Apr 2023 11:08:51 -0400 Subject: [PATCH] handle response from offer availibility check off thread --- core/src/main/java/haveno/core/offer/Offer.java | 4 ++-- core/src/main/java/haveno/core/trade/Trade.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/haveno/core/offer/Offer.java b/core/src/main/java/haveno/core/offer/Offer.java index e1d27dd956..b5a93d9c14 100644 --- a/core/src/main/java/haveno/core/offer/Offer.java +++ b/core/src/main/java/haveno/core/offer/Offer.java @@ -139,12 +139,12 @@ public class Offer implements NetworkPayload, PersistablePayload { // Availability /////////////////////////////////////////////////////////////////////////////////////////// - public void checkOfferAvailability(OfferAvailabilityModel model, ResultHandler resultHandler, + public synchronized void checkOfferAvailability(OfferAvailabilityModel model, ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) { availabilityProtocol = new OfferAvailabilityProtocol(model, () -> { cancelAvailabilityRequest(); - resultHandler.handleResult(); + new Thread(() -> resultHandler.handleResult()).start(); }, (errorMessage) -> { if (availabilityProtocol != null) diff --git a/core/src/main/java/haveno/core/trade/Trade.java b/core/src/main/java/haveno/core/trade/Trade.java index 0544770474..5280c06b54 100644 --- a/core/src/main/java/haveno/core/trade/Trade.java +++ b/core/src/main/java/haveno/core/trade/Trade.java @@ -1161,7 +1161,7 @@ public abstract class Trade implements Tradable, Model { public void onShutDownStarted() { isShutDownStarted = true; - if (wallet != null) log.info("{} {} onShutDownStarted()", getClass().getSimpleName(), getId()); + if (wallet != null) log.info("{} {} preparing for shut down", getClass().getSimpleName(), getId()); synchronized (this) { synchronized (walletLock) { stopPolling(); // allow locks to release before stopping @@ -1170,7 +1170,7 @@ public abstract class Trade implements Tradable, Model { } public void shutDown() { - if (wallet != null) log.info("{} {} onShutDown()", getClass().getSimpleName(), getId()); + if (wallet != null) log.info("{} {} shutting down", getClass().getSimpleName(), getId()); synchronized (this) { isInitialized = false; isShutDown = true;