Is screen controller thread safe?


I am wondering about whether it’s safe to store an object in the screen controller, is it safe to do the following for example:

public class IncrementValueWindow extends AbstractWindow {
    TextField field;

    Integer x = 0;

    public void onIncrementX(Component source){

    public void onShowX(Component source){


All the UI code is executed in a single-request-per-session mode. Once HTTP request is handled it obtains a special lock on the HTTP session and releases it after response is sent to client. It guarantees that all your screens / buttons / etc is updated correctly. It means that you can safely update any field / UI component / datasource from event handlers of UI components and UI actions.

It does not mean though that you can run multiple threads and update any UI thing in parallel, use BackgroundTasks for such background threads not bound to UI event handling.

1 Like