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 <[email protected]> wrote:


From: Olivier Monaco <[email protected]>
Subject: Re: Synchronous Calls with RPC??
To: "Google Web Toolkit" <[email protected]>
Date: Friday, May 14, 2010, 8:41 AM


Hi,

Doing synchronous call is globally a bad idea. What is your exact
need?

Olivier

On 14 mai, 17:05, fomba collins <[email protected]> wrote:
> 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?   
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/google-web-toolkit?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.




      

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to