Busy indicator for long running request

In a web UI I have implemented a service call that might take some time (max. up to 1 minute). Before the user invokes this service call a confirmation window pops up that asks the user something like “do you really want to invoke the long running request xyz…?”. This part of the implementation already works fine.

But after the user has confirmed the dialog I want some indication to be shown that tells the user “please be patient while long running request xyz is executed…”.

Please see the code-example below. My problem is the following: After the user confirmes the option dialog with “Yes”, then the dialog keeps showing until the execution of invokeLongRunningService() is completed. The user doesn’t get any feedback that the service call is now in progress.

How can I manage to do the following?

  1. Close the dialog right after the click on “Yes” and thus before the invocation of longRunningService.executeSomeLongRunningMethod();
  2. During the call of longRunningService.executeSomeLongRunningMethod(); show a message “please be patient while long running request xyz is executed…” that blocks the screen.

Or just do step 2. if this is possible without first closing the dialog.

public class MySampleScreen extends AbstractWindow {

    private MyLongRunningService longRunningService;

    public void onSomeButtonClick() {
        showOptionDialog(getMessage("confirmationTitle"), getMessage("confirmLongRequestMessage"), MessageType.CONFIRMATION,
                new Action[] { new DialogAction(DialogAction.Type.YES) {
                    public void actionPerform(Component component) {
                }, new DialogAction(DialogAction.Type.NO) });

    private void invokeLongRunningService() {

        boolean success = longRunningService.executeSomeLongRunningMethod();


Thanks for any help in advance!

I believe you are looking for BackgroundTasks.
Actually in docs you can find a good example with progress bar.