Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only close affected connections on Engine change #149

Open
Nielswps opened this issue Mar 17, 2023 · 0 comments
Open

Only close affected connections on Engine change #149

Nielswps opened this issue Mar 17, 2023 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@Nielswps
Copy link
Contributor

Nielswps commented Mar 17, 2023

When the user saves changes to the engines through the EngineOptionsDialog, all engines are re-instantiated and their connections are closed. It would be more efficient to only close the connections that are no longer in the active port range of the affected engines.

public static void updateEngineInstances(ArrayList<Engine> updatedEngines) {
BackendHelper.engines = FXCollections.observableList(updatedEngines);
for (Runnable runnable : BackendHelper.enginesUpdatedListeners) {
runnable.run();
}
}

// Close all engine connections to avoid dangling engine connections when port range is changed
try {
Ecdar.getBackendDriver().closeAllEngineConnections();
} catch (IOException e) {

⚠️ This change might seem fairly easy, but it should include a refactor of the way engines are referenced and handled in the EngineOptionsDialogController.

This also becomes an issue if long-running queries are started and then the port range is changed for the associated engine in order to run other queries. This case would result in the long-running query being canceled. (Thanks to @Brandhoej for this example of the issue)

Suggested approach

I suggest that the EngineInstance (the visual representation of the engine within the EngineOptionsDialog) does not operate on the engines, but instead takes an Engine as a constructor parameter for populating the input fields and then has a method for constructing an engine based on the values of these fields.

@Nielswps Nielswps added bug Something isn't working enhancement New feature or request labels Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant