Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

How to wait for all pending RPC requests to finish

$
0
0
We have a complex set of screens that are presented in a TabSet in a Window. Various user actions can trigger DSRequests to add/update data in a number of different datasources. When the user closes the window we need to submit a final request to do some housekeeping tasks, but this final request must only be submitted after any other pending requests have completed.

We have added a CloseClickEvent handler to the Window and I see that RPCManager has a requestsArePending() method, but how can I wait for all pending requests to finish? I tried this but it just starts an endless loop.
Code:

while (RPCManager.requestsArePending()) {
        Timer t = new Timer() {
                @Override
                public void run() {
                        // Do nothing but wait.
                }
        };
        t.schedule(300);
}


Viewing all articles
Browse latest Browse all 4756

Trending Articles