Hi!
I’m new to Vaadin and currently wondering if there is a safe way to modify/access UI elements from background/worker threads.
I understand that it is safe in case of ProgressIndicator because assigning and reading a single object reference is an atomic operation. However, more complex modifications (like inserting an item into a table) are not atomic.
For example imagine the following scenario: The client has sent a repaint request. Currently a table is repainted and Vaadin is iterating over the table item list. In that moment a worker thread inserts a new item into the table. As another thread (the thread doing the repainting) is currently iterating about the item list, this will probably result in a ConcurrentModificationException or other strange effects.
In the non-Web-Application area I’ve worked with eclipse SWT. They offer org.eclipse.swt.widgets.Display#syncExec(java.lang.Runnable) to access and modify UI elements in a multi-threading safe way. Is there a similar concept in Vaadin?
Best Regards,
Stefan