diff --git a/common/src/main/java/bisq/common/setup/CommonSetup.java b/common/src/main/java/bisq/common/setup/CommonSetup.java index cc23cf5f6c5..0ab19dab310 100644 --- a/common/src/main/java/bisq/common/setup/CommonSetup.java +++ b/common/src/main/java/bisq/common/setup/CommonSetup.java @@ -55,19 +55,21 @@ public static void setup(Config config, GracefulShutDownHandler gracefulShutDown Version.printVersion(); maybePrintPathOfCodeSource(); Profiler.printSystemLoad(); - Profiler.printSystemLoadPeriodically(10, TimeUnit.MINUTES); // Full DAO nodes (like seed nodes) do not use the GC triggers as it is expected they have sufficient RAM allocated. GcUtil.setDISABLE_GC_CALLS(config.fullDaoNode); - GcUtil.autoReleaseMemory(); - setSystemProperties(); setupSigIntHandlers(gracefulShutDownHandler); DevEnv.setup(config); } + public static void startPeriodicTasks() { + Profiler.printSystemLoadPeriodically(10, TimeUnit.MINUTES); + GcUtil.autoReleaseMemory(); + } + public static void setupUncaughtExceptionHandler(UncaughtExceptionHandler uncaughtExceptionHandler) { Thread.UncaughtExceptionHandler handler = (thread, throwable) -> { // Might come from another thread diff --git a/core/src/main/java/bisq/core/app/BisqExecutable.java b/core/src/main/java/bisq/core/app/BisqExecutable.java index 0ab2895819f..3e8fdc587f1 100644 --- a/core/src/main/java/bisq/core/app/BisqExecutable.java +++ b/core/src/main/java/bisq/core/app/BisqExecutable.java @@ -130,8 +130,13 @@ protected void addCapabilities() { /////////////////////////////////////////////////////////////////////////////////////////// // Headless versions can call inside launchApplication the onApplicationLaunched() manually + // Desktop gets called from JavaFx thread protected void onApplicationLaunched() { configUserThread(); + + // Now we can use the user thread start periodic tasks + CommonSetup.startPeriodicTasks(); + // As the handler method might be overwritten by subclasses and they use the application as handler // we need to setup the handler after the application is created. CommonSetup.setupUncaughtExceptionHandler(this); diff --git a/desktop/src/main/java/bisq/desktop/app/BisqAppMain.java b/desktop/src/main/java/bisq/desktop/app/BisqAppMain.java index d2577194db9..a875e83ca66 100644 --- a/desktop/src/main/java/bisq/desktop/app/BisqAppMain.java +++ b/desktop/src/main/java/bisq/desktop/app/BisqAppMain.java @@ -73,8 +73,8 @@ protected void configUserThread() { protected void launchApplication() { BisqApp.setAppLaunchedHandler(application -> { BisqAppMain.this.application = (BisqApp) application; - // Map to user thread! - UserThread.execute(this::onApplicationLaunched); + + onApplicationLaunched(); }); Application.launch(BisqApp.class); diff --git a/seednode/src/main/java/bisq/seednode/SeedNodeMain.java b/seednode/src/main/java/bisq/seednode/SeedNodeMain.java index 080aff96d21..5bfb17ceff6 100644 --- a/seednode/src/main/java/bisq/seednode/SeedNodeMain.java +++ b/seednode/src/main/java/bisq/seednode/SeedNodeMain.java @@ -79,7 +79,7 @@ protected void launchApplication() { UserThread.execute(() -> { try { seedNode = new SeedNode(); - UserThread.execute(this::onApplicationLaunched); + onApplicationLaunched(); } catch (Exception e) { e.printStackTrace(); }