Friday, June 15, 2012

About nested RPC call

just for example of nested server call, assume I need the following three server call in sequence
1) call server to select the count of records satisfy the criteria
2) if call1 success, call server to select the content of records satisfy the criteria
3) if call1 and call2 success, call server to put the criteria in session

as RPC is Async., so I need to write something like the following?
AsyncCallback callback1 = new AsyncCallback(){

  public void onSuccess(){
      AsyncCallback callback2 = new AsyncCallback(){
        public void onSuccess(){
            AsyncCallback callback3 = new AsyncCallback(){
                public void onSuccess(){

                }
                @Override
                public void onFailure(Throwable caught){
                 
                }
            }
        }
        @Override
        public void onFailure(Throwable caught){
         
        }
      }
  }
  @Override
  public void onFailure(Throwable caught){
 
  }
}

As shown, it is very ugly and difficult to trace...
any better method?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/4NvFVZK99noJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate