The application is having four javafx fxml-screens : login, home, profile and features. A lots of worker thread is created in various screens after login is done. When user is getting logout, the all worker thread except Javafx-Application-Thread should be cancelled.
How to kill all/particular background thread in Javafx?
1.4k views Asked by shambhu At
2
There are 2 answers
0
On
A convenient way to manage your worker threads is to use the Executor framework.
Example:
ExecutorService executorService = Executors.newFixedThreadPool(2);
// submit your JavaFX tasks and services
executorService.shutdown();
//executorService.shutdownNow();
More about Java and JavaFX concurrency:
There is not any mechanism for kill any thread in javafx.
but y can cancel the particular thread using cancel() method.