Merge pull request #4461 from ghubstan/1-singleton-coreapi

Make CoreApi a singleton
This commit is contained in:
sqrrm 2020-09-02 14:44:23 +02:00 committed by GitHub
commit 604dabbb46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 12 deletions

View File

@ -4,6 +4,8 @@ import joptsimple.ArgumentAcceptingOptionSpec;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import com.google.common.annotations.VisibleForTesting;
import java.util.ArrayList;
import java.util.List;
@ -17,6 +19,7 @@ import java.util.List;
* the command line with those provided via config file, such that those provided at the
* command line take precedence over those provided in the config file.
*/
@VisibleForTesting
public class CompositeOptionSet {
private final List<OptionSet> optionSets = new ArrayList<>();

View File

@ -31,6 +31,7 @@ import bisq.common.app.Version;
import org.bitcoinj.core.Coin;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.ArrayList;
import java.util.List;
@ -42,6 +43,7 @@ import lombok.extern.slf4j.Slf4j;
* Provides high level interface to functionality of core Bisq features.
* E.g. useful for different APIs to access data of different domains of Bisq.
*/
@Singleton
@Slf4j
public class CoreApi {

View File

@ -62,7 +62,6 @@ public class BisqAppMain extends BisqExecutable {
log.debug("onSetupComplete");
}
///////////////////////////////////////////////////////////////////////////////////////////
// First synchronous execution tasks
///////////////////////////////////////////////////////////////////////////////////////////
@ -87,7 +86,6 @@ public class BisqAppMain extends BisqExecutable {
Application.launch(BisqApp.class);
}
///////////////////////////////////////////////////////////////////////////////////////////
// As application is a JavaFX application we need to wait for onApplicationLaunched
///////////////////////////////////////////////////////////////////////////////////////////
@ -123,21 +121,13 @@ public class BisqAppMain extends BisqExecutable {
@Override
protected void startApplication() {
// We need to be in user thread! We mapped at launchApplication already...
// Once the UI is ready we get onApplicationStarted called and start the setup there
// We need to be in user thread! We mapped at launchApplication already. Once
// the UI is ready we get onApplicationStarted called and start the setup there.
application.startApplication(this::onApplicationStarted);
}
@Override
protected void onApplicationStarted() {
super.onApplicationStarted();
/*
if (runWithGrpcApi()) {
CoreApi coreApi = injector.getInstance(CoreApi.class);
bisqGrpcServer = new BisqGrpcServer(coreApi);
}
*/
}
}