- JavaFx Scene Graph is not thread Safe.
- JavaFX application, also known as the JavaFX
Application thread, is not thread safe.
- Implementing long-running tasks on the JavaFX Application
thread may pose UI unresponsive risks.
- A best practice is to do these tasks on one or more
background threads and let the JavaFX Application thread process
user events.
If you have special requirements or need extra power over the
code, implementing a background worker by creating a Runnable
object and a new thread is an appropriate way to go. Note that
at some point you must communicate with the JavaFX Application
thread, either with a result or with the progress of the
background task.
- For the most cases and for the majority of developers the
recommended way is to use the JavaFX APIs provided by the
javafx.concurrent package, which takes care of multithreaded
code that interacts with the UI and ensures that this
interaction happens on the correct thread.
|