mirror of
https://github.com/bisq-network/bisq.git
synced 2025-03-12 18:49:03 +01:00
RestApi: Fix parseBlockCompleteAfterBatchProcessing data race
The parseBlockCompleteAfterBatchProcessing field is set on the block parsing thread and read by Jersey's HTTP threads. By default, Jersey handles requests synchronous on multiple threads.
This commit is contained in:
parent
f079e26e09
commit
9463bf562c
1 changed files with 5 additions and 3 deletions
|
@ -38,6 +38,8 @@ import bisq.core.user.Preferences;
|
||||||
import bisq.common.app.Version;
|
import bisq.common.app.Version;
|
||||||
import bisq.common.config.Config;
|
import bisq.common.config.Config;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@ -69,7 +71,7 @@ public class RestApi extends ExecutableForAppWithP2p {
|
||||||
private OfferBookService offerBookService;
|
private OfferBookService offerBookService;
|
||||||
private PriceFeedService priceFeedService;
|
private PriceFeedService priceFeedService;
|
||||||
@Getter
|
@Getter
|
||||||
private boolean parseBlockCompleteAfterBatchProcessing;
|
private final AtomicBoolean parseBlockCompleteAfterBatchProcessing = new AtomicBoolean();
|
||||||
|
|
||||||
public RestApi() {
|
public RestApi() {
|
||||||
super("Bisq Rest Api", "bisq_restapi", "bisq_restapi", Version.VERSION);
|
super("Bisq Rest Api", "bisq_restapi", "bisq_restapi", Version.VERSION);
|
||||||
|
@ -108,7 +110,7 @@ public class RestApi extends ExecutableForAppWithP2p {
|
||||||
@Override
|
@Override
|
||||||
public void onParseBlockCompleteAfterBatchProcessing(Block block) {
|
public void onParseBlockCompleteAfterBatchProcessing(Block block) {
|
||||||
log.error("onParseBlockCompleteAfterBatchProcessing");
|
log.error("onParseBlockCompleteAfterBatchProcessing");
|
||||||
parseBlockCompleteAfterBatchProcessing = true;
|
parseBlockCompleteAfterBatchProcessing.set(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -130,6 +132,6 @@ public class RestApi extends ExecutableForAppWithP2p {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkDaoReady() {
|
public void checkDaoReady() {
|
||||||
checkArgument(parseBlockCompleteAfterBatchProcessing, "DAO not ready yet");
|
checkArgument(parseBlockCompleteAfterBatchProcessing.get(), "DAO not ready yet");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue