Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make CoreApi a singleton #4461

Merged
merged 3 commits into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import joptsimple.OptionSet;
import joptsimple.OptionSpec;

import com.google.common.annotations.VisibleForTesting;

import java.util.ArrayList;
import java.util.List;

Expand All @@ -17,6 +19,7 @@
* 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<>();
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/bisq/core/api/CoreApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.bitcoinj.core.Coin;

import javax.inject.Inject;
import javax.inject.Singleton;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -42,6 +43,7 @@
* 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 {

Expand Down
14 changes: 2 additions & 12 deletions desktop/src/main/java/bisq/desktop/app/BisqAppMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public void onSetupComplete() {
log.debug("onSetupComplete");
}


///////////////////////////////////////////////////////////////////////////////////////////
// First synchronous execution tasks
///////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -87,7 +86,6 @@ protected void launchApplication() {
Application.launch(BisqApp.class);
}


///////////////////////////////////////////////////////////////////////////////////////////
// As application is a JavaFX application we need to wait for onApplicationLaunched
///////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -123,21 +121,13 @@ protected void setupPersistedDataHosts(Injector injector) {

@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);
}
*/
}
}