Bug: Not on FX application thread exception is inconsistent
tbee at tbee.org
Tue Nov 13 16:06:43 UTC 2018
> This isn't me not doing my research, this is objectively JavaFX not providing the functionality that is necessary to do something rather trivial: update an API object and provide information from that API object right after it's updated to the user(without ChangeListener).
You are not using the right tool for the job. Thread management is not the responsibility of the UI toolkit, all it does is require that you got your stuff in order and run its code on the appropriate thread. Platform.run and runAndWait are just entry points for doing that, not multithreading solutions. There are good libraries for asynchronous execution; just use CompletableFuture, RxJava or JDeffered. RxJava even has build in support for putting a task back onto the JavaFX UI thread: observeOn(JavaFxScheduler.platform()).
More information about the openjfx-dev