handle response from offer availibility check off thread
This commit is contained in:
parent
2b7a461411
commit
0c3761b172
@ -139,12 +139,12 @@ public class Offer implements NetworkPayload, PersistablePayload {
|
|||||||
// Availability
|
// Availability
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public void checkOfferAvailability(OfferAvailabilityModel model, ResultHandler resultHandler,
|
public synchronized void checkOfferAvailability(OfferAvailabilityModel model, ResultHandler resultHandler,
|
||||||
ErrorMessageHandler errorMessageHandler) {
|
ErrorMessageHandler errorMessageHandler) {
|
||||||
availabilityProtocol = new OfferAvailabilityProtocol(model,
|
availabilityProtocol = new OfferAvailabilityProtocol(model,
|
||||||
() -> {
|
() -> {
|
||||||
cancelAvailabilityRequest();
|
cancelAvailabilityRequest();
|
||||||
resultHandler.handleResult();
|
new Thread(() -> resultHandler.handleResult()).start();
|
||||||
},
|
},
|
||||||
(errorMessage) -> {
|
(errorMessage) -> {
|
||||||
if (availabilityProtocol != null)
|
if (availabilityProtocol != null)
|
||||||
|
@ -1161,7 +1161,7 @@ public abstract class Trade implements Tradable, Model {
|
|||||||
|
|
||||||
public void onShutDownStarted() {
|
public void onShutDownStarted() {
|
||||||
isShutDownStarted = true;
|
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 (this) {
|
||||||
synchronized (walletLock) {
|
synchronized (walletLock) {
|
||||||
stopPolling(); // allow locks to release before stopping
|
stopPolling(); // allow locks to release before stopping
|
||||||
@ -1170,7 +1170,7 @@ public abstract class Trade implements Tradable, Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void shutDown() {
|
public void shutDown() {
|
||||||
if (wallet != null) log.info("{} {} onShutDown()", getClass().getSimpleName(), getId());
|
if (wallet != null) log.info("{} {} shutting down", getClass().getSimpleName(), getId());
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
isInitialized = false;
|
isInitialized = false;
|
||||||
isShutDown = true;
|
isShutDown = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user