Skip to content

Commit

Permalink
Merge pull request #4461 from ghubstan/1-singleton-coreapi
Browse files Browse the repository at this point in the history
Make CoreApi a singleton
  • Loading branch information
sqrrm authored Sep 2, 2020
2 parents 095c8b5 + 804adf0 commit 604dabb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
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);
}
*/
}
}

0 comments on commit 604dabb

Please sign in to comment.