In AbstractJavaFxApplicationSupport, there appears to be a concurrency issue. On line 166, there is a synchronize-statement that doesn't do anything unless multiple threads are invoking the start(Stage)-method at the same time. It doesn't prevent appCtxLoaded from being modified outside the synchronized block, which is the case in launchApplicationView.
synchronized (this) { // This does not prevent other threads from modifying appCtxLoaded from a different method!!
if (appCtxLoaded.get()) {
// Spring ContextLoader was faster
Platform.runLater(showMainAndCloseSplash);
} else {
appCtxLoaded.addListener((ov, oVal, nVal) -> {
Platform.runLater(showMainAndCloseSplash);
});
}
}
The correct way of doing this would be to remove the synchronized-statement, change the BooleanProperty to a CompletableFuture that completes once the splash-message is showing and then close the splash once both the "splash is showing" and "context is loaded" conditions are satisfied.
In
AbstractJavaFxApplicationSupport
, there appears to be a concurrency issue. On line 166, there is a synchronize-statement that doesn't do anything unless multiple threads are invoking the start(Stage)-method at the same time. It doesn't preventappCtxLoaded
from being modified outside the synchronized block, which is the case inlaunchApplicationView
.The correct way of doing this would be to remove the synchronized-statement, change the
BooleanProperty
to aCompletableFuture
that completes once the splash-message is showing and then close the splash once both the "splash is showing" and "context is loaded" conditions are satisfied.