Add 1 sec delay before calling exit

To persist in the very last moment before exit might cause problems on some OS.
We do not have confirmed that this might be an issue but to be on the safe side
we add a 1 sec. delay between persistence completed and exit.
This commit is contained in:
chimp1984 2020-11-23 18:22:44 -05:00
parent 779c059a51
commit 6b3a002b1c
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
2 changed files with 6 additions and 6 deletions

View File

@ -239,7 +239,7 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet
PersistenceManager.flushAllDataToDisk(() -> {
log.info("Graceful shutdown completed. Exiting now.");
resultHandler.handleResult();
System.exit(EXIT_SUCCESS);
UserThread.runAfter(() -> System.exit(EXIT_SUCCESS), 1);
});
});
});
@ -253,7 +253,7 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet
PersistenceManager.flushAllDataToDisk(() -> {
log.info("Graceful shutdown resulted in a timeout. Exiting now.");
resultHandler.handleResult();
System.exit(EXIT_SUCCESS);
UserThread.runAfter(() -> System.exit(EXIT_SUCCESS), 1);
});
}, 20);
} catch (Throwable t) {
@ -262,7 +262,7 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet
PersistenceManager.flushAllDataToDisk(() -> {
log.info("Graceful shutdown resulted in an error. Exiting now.");
resultHandler.handleResult();
System.exit(EXIT_FAILURE);
UserThread.runAfter(() -> System.exit(EXIT_FAILURE), 1);
});
}
}

View File

@ -95,7 +95,7 @@ public abstract class ExecutableForAppWithP2p extends BisqExecutable {
PersistenceManager.flushAllDataToDisk(() -> {
resultHandler.handleResult();
log.info("Graceful shutdown completed. Exiting now.");
System.exit(BisqExecutable.EXIT_SUCCESS);
UserThread.runAfter(() -> System.exit(BisqExecutable.EXIT_SUCCESS), 1);
});
});
injector.getInstance(WalletsSetup.class).shutDown();
@ -107,7 +107,7 @@ public abstract class ExecutableForAppWithP2p extends BisqExecutable {
PersistenceManager.flushAllDataToDisk(() -> {
resultHandler.handleResult();
log.info("Graceful shutdown caused a timeout. Exiting now.");
System.exit(BisqExecutable.EXIT_SUCCESS);
UserThread.runAfter(() -> System.exit(BisqExecutable.EXIT_SUCCESS), 1);
});
}, 5);
} else {
@ -122,7 +122,7 @@ public abstract class ExecutableForAppWithP2p extends BisqExecutable {
PersistenceManager.flushAllDataToDisk(() -> {
resultHandler.handleResult();
log.info("Graceful shutdown resulted in an error. Exiting now.");
System.exit(BisqExecutable.EXIT_FAILURE);
UserThread.runAfter(() -> System.exit(BisqExecutable.EXIT_FAILURE), 1);
});
}