Hi, Is there a way of making synchronous calls in GWT using RPC. I actually need something on the client side to ensure that the asynchronous processing in rpc is complete. Can Anyone help? |
I have a method that uses the response of an asynchronous call. Here is it:
for(int i=0;i<listeOfApplications.size();i++) {
menuItem.setText(listeOfApplications.get(i).toString());
MenuSetup ms1 = new MenuSetup(menu, menuItem); ms1.getSubMenus(); } During each iteraton, the getSubMenus() method has to be called. The getSubMenus() is as follows:
public void getSubMenus(){
try { con.getSubMenus(menuItem.getText(), new AsyncCallback<ArrayList<String>>() {
public void onFailure(Throwable caught) { System.out.println("Remote Procedure Call apps- Failure");
}
public void onSuccess(ArrayList<String> result) { Menu men = new Menu(); for(int i =0; i< result.size();i++) { MenuItem menuItem1 = new MenuItem(result.get(i)); menuItem1.addSelectionListener(menuListener); men.add(menuItem1); } menuItem.setSubMenu(men); menu.add(menuItem);
} }); } catch (Exception e) { e.printStackTrace(); }
}
Now, for each iteration on the listeOfApplications list, the getSubMenus() is to be called. But what happens here is that all the iterations take place before the getSubMenus() method starts execution.
Is there a way to know on the client side that the execution of the asynchronous call has ended? I need this to control my iterations. I have tried wait(); but it does not work. Help!!!
--- On Fri, 5/14/10, Olivier Monaco <olivier...@free.fr> wrote: |
|
|
|
|
|
I'm not sure about adding this feature but
maybe a better documentation about the "bad" idea of using sync
request.