Multithreading in MvvmFx

74 views
Skip to first unread message

eddy...@gmail.com

unread,
Mar 6, 2017, 7:59:04 PM3/6/17
to MvvmFX
I am planning to start using mvvmfx in our desktop projects  me and my team.

I want to know with all these mechanisms built in to the framework how is multithreading handled by the framework.

Manuel Mauky

unread,
Mar 7, 2017, 4:24:17 AM3/7/17
to MvvmFX, eddy...@gmail.com
Hi,

the framework itself isn't multithreaded. The loading process is wrapping the normal JavaFX FXMLLoader which is not using multithreading for loading. We had some discussions about async loading here: https://github.com/sialcasa/mvvmFX/issues/451
and I've documented how to load parts of the UI in a background thread here: https://github.com/sialcasa/mvvmFX/wiki/Asynchronous-Operations

Where asynchronicity comes into play is when you load data from your backend services. This has to be done on a background thread because otherwise the UI would be blocked. There are multiple ways of handling this.
You can use standard JavaFX Services and Tasks, you can use CompletableFutures (there is an example for this here: https://github.com/sialcasa/mvvmFX/tree/develop/examples/mini-examples/async-todoapp-futures) or you can use mvvmFX Commands which is a mechanism developed by us and described here: https://github.com/sialcasa/mvvmFX/wiki/Commands.
Basically it's only a choice of what API you prefer.

I hope this answers your question?
Reply all
Reply to author
Forward
0 new messages