Add setupStage and setDatabaseCorruptionHandler methods

This commit is contained in:
Manfred Karrer 2018-04-07 15:58:04 -05:00
parent 8a266b16bb
commit 101365aef6
No known key found for this signature in database
GPG key ID: 401250966A6B2C46

View file

@ -175,16 +175,24 @@ public class BisqApp extends Application {
if (Utilities.isLinux())
System.setProperty("prism.lcdtext", "false");
Storage.setDatabaseCorruptionHandler((String fileName) -> {
corruptedDatabaseFiles.add(fileName);
if (mainView != null)
mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles);
});
setupStage();
setDatabaseCorruptionHandler(mainView);
checkForCorrectOSArchitecture();
UserThread.runPeriodically(() -> Profiler.printSystemLoad(log), LOG_MEMORY_PERIOD_MIN, TimeUnit.MINUTES);
} catch (Throwable throwable) {
log.error("Error during app init", throwable);
showErrorPopup(throwable, false);
}
}
private void setupStage() {
// load the main view and create the main scene
CachingViewLoader viewLoader = injector.getInstance(CachingViewLoader.class);
mainView = (MainView) viewLoader.load(MainView.class);
mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles);
scene = new Scene(mainView.getRoot(), INITIAL_SCENE_WIDTH, INITIAL_SCENE_HEIGHT);
@ -222,13 +230,15 @@ public class BisqApp extends Application {
// make the UI visible
primaryStage.show();
checkForCorrectOSArchitecture();
UserThread.runPeriodically(() -> Profiler.printSystemLoad(log), LOG_MEMORY_PERIOD_MIN, TimeUnit.MINUTES);
} catch (Throwable throwable) {
log.error("Error during app init", throwable);
showErrorPopup(throwable, false);
}
private void setDatabaseCorruptionHandler(MainView mainView) {
Storage.setDatabaseCorruptionHandler((String fileName) -> {
corruptedDatabaseFiles.add(fileName);
if (mainView != null)
mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles);
});
mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles);
}