run arbitrator protocol on trade thread
This commit is contained in:
parent
11c8b05f45
commit
ea4359d164
@ -1,5 +1,6 @@
|
|||||||
package haveno.core.trade.protocol;
|
package haveno.core.trade.protocol;
|
||||||
|
|
||||||
|
import haveno.common.ThreadUtils;
|
||||||
import haveno.common.handlers.ErrorMessageHandler;
|
import haveno.common.handlers.ErrorMessageHandler;
|
||||||
import haveno.core.trade.ArbitratorTrade;
|
import haveno.core.trade.ArbitratorTrade;
|
||||||
import haveno.core.trade.Trade;
|
import haveno.core.trade.Trade;
|
||||||
@ -43,7 +44,7 @@ public class ArbitratorProtocol extends DisputeProtocol {
|
|||||||
|
|
||||||
public void handleInitTradeRequest(InitTradeRequest message, NodeAddress peer, ErrorMessageHandler errorMessageHandler) {
|
public void handleInitTradeRequest(InitTradeRequest message, NodeAddress peer, ErrorMessageHandler errorMessageHandler) {
|
||||||
System.out.println("ArbitratorProtocol.handleInitTradeRequest()");
|
System.out.println("ArbitratorProtocol.handleInitTradeRequest()");
|
||||||
new Thread(() -> {
|
ThreadUtils.execute(() -> {
|
||||||
synchronized (trade) {
|
synchronized (trade) {
|
||||||
latchTrade();
|
latchTrade();
|
||||||
this.errorMessageHandler = errorMessageHandler;
|
this.errorMessageHandler = errorMessageHandler;
|
||||||
@ -68,7 +69,7 @@ public class ArbitratorProtocol extends DisputeProtocol {
|
|||||||
.executeTasks(true);
|
.executeTasks(true);
|
||||||
awaitTradeLatch();
|
awaitTradeLatch();
|
||||||
}
|
}
|
||||||
}).start();
|
}, trade.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -78,7 +79,7 @@ public class ArbitratorProtocol extends DisputeProtocol {
|
|||||||
|
|
||||||
public void handleDepositRequest(DepositRequest request, NodeAddress sender) {
|
public void handleDepositRequest(DepositRequest request, NodeAddress sender) {
|
||||||
System.out.println("ArbitratorProtocol.handleDepositRequest() " + trade.getId());
|
System.out.println("ArbitratorProtocol.handleDepositRequest() " + trade.getId());
|
||||||
new Thread(() -> {
|
ThreadUtils.execute(() -> {
|
||||||
synchronized (trade) {
|
synchronized (trade) {
|
||||||
latchTrade();
|
latchTrade();
|
||||||
Validator.checkTradeId(processModel.getOfferId(), request);
|
Validator.checkTradeId(processModel.getOfferId(), request);
|
||||||
@ -103,7 +104,7 @@ public class ArbitratorProtocol extends DisputeProtocol {
|
|||||||
.executeTasks(true);
|
.executeTasks(true);
|
||||||
awaitTradeLatch();
|
awaitTradeLatch();
|
||||||
}
|
}
|
||||||
}).start();
|
}, trade.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user