I am wondering what kind of thread-safety issues one has to take into account when using the Vaadin framework. The first thing I noticed, and that I am not sure of, is the following: Using Vaadin 8.1, I am setting up a grid backed by an in-memory collection of some custom objects like this:
[code]
public class MyView implements View {
private Grid grid = new Grid<>();
public MyView() {
ListDataProvider dataProvider = DataProvider.ofCollection(createSomeObjects());
this.grid.setDataProvider(dataProvider);
// attach grid to view …
}
// @Override View#enter etc. …
}
public class MyObject {
// just a POJO …, no synchronization or anything
private String someString;
public void setSomeString(String s) {this.someString = s;}
public String getSomeString() {
LOGGER.debug(“getter called”);
return this.someString;
}
}
[/code]Now, if I use the scrollbar of the grid, I can see that different threads are entering the getSomeString() method. This is not so surprising, as probably each scrollbar interaction is handled with a separate request running in a different thread, but I could not find any information telling me whether the access into MyObject is synchronized. Is there anything that needs to be done regarding thread-safety in this scenario ?