ProgressBar inside ConfirmDialog onClose

Is there a way to trigger a progress bar inside the onClose method triggered by the ConfirmDialog? The below code does not work, and was wondering what I am doing wrong.

[code]
ConfirmDialog.show( UI.getCurrent(),
“Go Live”,
"Going live with " + title +
“. Are you sure?”, “Yes”, “No”, new ConfirmDialog.Listener() {

        @Override
        public void onClose(ConfirmDialog dialog) {
            if( dialog.isConfirmed() )
            {
                ProgressBar progressBar = new ProgressBar();
                progressBar.setIndeterminate(true);
                Window progressWindow = new Window("Going live with " + title, progressBar);
                progressWindow.center();
                UI.getCurrent().addWindow(progressWindow);
                goLive();
                UI.getCurrent().removeWindow(progressWindow);
            }
        }
    });

[/code]The “goLive” method could take a moment to come back, and I want the application to be friendly. Right now, if the user is not paying attention, they might think they still need to click “Yes”, or that it is still valid to click “No”. A progress indicator of some sot would be ideal in such situations.

The trouble is that the goLive() method blocks the Vaadin UI thread, which thus can’t finish and can’t send the contents of the new window to the browser. What actually happens is that a Window is created and then removed in that very same request. Since the window is removed, Vaadin does not send it to the client.

To remedy this, you will need to run goLive() in a background thread, allowing the UI thread to finish and send the new Window to the browser. When the goLive() finishes, just call UI.access() from that background thread. Note that UI.access() won’t contact the browser unless you enable @Push on your UI.

Hope this helps - please read here for more information on Push:
https://vaadin.com/docs/-/part/framework/advanced/advanced-push.html