I have an app that uses Vaadin push to send data to multiple sessions every second. The data is continuously produced upstream in another thread by a DataService class outside of the Vaadin framework. Each subclass of Vaadin.UI has its own DataService reference created by init(). DataService makes the latest data available to the UI. All DataService instances (one per UI) provide the same data originating from the same source. All the Vaadin sessions must push the same data to their UIs (session scope).
I’m trying to migrate the app to use Vaadin 7 and perform the data updates efficiently for each session and for each UI.
One way may be to make each UI an Observer of its own DataService instance, and then whenever the UI isVisible, let update(Observable) call VaadinSession.access(new Runnable() …grab the latest data from the DataService thread and perform the UI update… ). But then the access method would be called for all visible UIs concurrently. The access does not appear to be synchronized w.r.t. VaadinSession. I don’t know how safe or how efficient this way of doing things is.
Is there a better/safer way to update all the sessions and UIs simultaneously with a minimum number of calls to access?
Looking for ideas…
Many thanks.