Summary
In PluginsController, the displayPlugins() method calls pluginRepository.findAll() (a database/I-O operation) directly on the JavaFX Application Thread via FX.run(this::displayPlugins). This blocks rendering and input processing for the duration of the query.
Location
File: owlplug-client/src/main/java/com/owlplug/plugin/controllers/PluginsController.java
Affected methods:
displayPlugins() — invokes pluginRepository.findAll()
handle(PluginUpdateEvent) — schedules displayPlugins() on the FX thread via FX.run
Suggested Fix
Fetch the data on a background thread (e.g., using CompletableFuture.supplyAsync) and only apply the result to the UI on the FX thread:
@EventListener
private void handle(PluginUpdateEvent event) {
CompletableFuture
.supplyAsync(pluginRepository::findAll)
.thenAccept(plugins -> FX.run(() -> {
treeViewController.setPlugins(plugins);
tableController.setPlugins(plugins);
}));
}
This pattern may also apply to other displayPlugins() call sites.
Context
Identified during review of PR #449 (comment: #449 (comment)). Deferred from that PR as it requires a broader design change.
Requested by: @DropSnorz
Summary
In
PluginsController, thedisplayPlugins()method callspluginRepository.findAll()(a database/I-O operation) directly on the JavaFX Application Thread viaFX.run(this::displayPlugins). This blocks rendering and input processing for the duration of the query.Location
File:
owlplug-client/src/main/java/com/owlplug/plugin/controllers/PluginsController.javaAffected methods:
displayPlugins()— invokespluginRepository.findAll()handle(PluginUpdateEvent)— schedulesdisplayPlugins()on the FX thread viaFX.runSuggested Fix
Fetch the data on a background thread (e.g., using
CompletableFuture.supplyAsync) and only apply the result to the UI on the FX thread:This pattern may also apply to other
displayPlugins()call sites.Context
Identified during review of PR #449 (comment: #449 (comment)). Deferred from that PR as it requires a broader design change.
Requested by: @DropSnorz