mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-20 13:54:32 +01:00
Extract code in CommonSetup which uses a timer
to startPeriodicTasks. Call that from BisqExecutable.onApplicationLaunched We have created a non-UI timer before for the printSystemLoadPeriodically as that was called before the configUserThread was called (where we define the UI timer for desktop)
This commit is contained in:
parent
245b76be74
commit
faa8bd2ab2
2 changed files with 10 additions and 3 deletions
|
@ -55,19 +55,21 @@ public class CommonSetup {
|
|||
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
|
||||
|
|
|
@ -130,8 +130,13 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// 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);
|
||||
|
|
Loading…
Add table
Reference in a new issue