Paraphrasing what I said above, I think developers are basically trying to create a synchronous experience for their users*, which is a perfectly reasonable goal, not to be confused with synchronous RPC calls. Hopefully, recognizing that these are two different things will help.
Walden * "synchronous" in this context meaning that between user and particular UI component, user should wait until the latter becomes ready, and this is intentional design for usability On Aug 27, 4:31 pm, Folke <[EMAIL PROTECTED]> wrote: > You can emulate synchronous behavior by following these rules: > > 1. Any RPC or other call has to be made at the end of a method/ > function. Theoretically, the call may return before the method has > finished. Don't put any other code at the end. > 2. Don't use Timers or make sure all Timers have stopped. > 3. Disable all widgets or at least those that have listeners attached > to them. Re-enable them in a function that is called by onSuccess() > and onFailure(). > > If you stick to these rules I'm fairly certain that your application > state will not change while the RPC is being run, but you can still > use your browser for other things. Also, synchronous calls may look > like an option to you now, but you may want your app to do other > things in parallel in the future. That is not uncommon, believe me. By > then switching to async calls may be exponentially more difficult. > > I recommend you put Thread.sleep(5000); in each of your > RemoteServiceServlet methods. Then you will see how grateful your > users will be if you use asynchronous calls right from the start. > > On 26 Aug., 19:53, ping2ravi <[EMAIL PROTECTED]> wrote: > > > > > yes i do have have workaround for this, but was just wondering if i > > can use any of GWT feature. > > Also i read in GWT FAQ, GWT do not support Synchronous calls and in > > future they are not planning to have it(they have some theory). So i > > guess need to implement my own > > workaround.http://code.google.com/support/bin/answer.py?answer=55195&topic=10210 > > > But guys just a question of thought, Don't you think having a > > synchronous call feature will be added advantage. > > > Lets say u build a application and u have something like if user > > logged out of application because of idle session then when user try > > to do anything on application. instead of forwarding him to some user > > login page , we just popup a login/password panel thing. And usually > > on click we will call the login on server and close the dialogue > > box(againw e can keep it open and in onSuccess function we can close > > it, but for me not a good idea) > > And as the call is asynchrnous so once we call the Login on server, > > user is allowed to do other click in application(before he actually > > login to server) and he will again see that u r not logged in. > > Its just a small example. > > > But i think having synchronous call will be good thing. > > > Thanks for reading > > Ravi. > > > On Aug 26, 5:03 pm, "Pavel Byles" <[EMAIL PROTECTED]> wrote: > > > > can't you just do: > > > doTaskCallBack { > > > onResponse(...) { > > > userService.doSynchronousTask(...); > > > } > > > > } > > > > Wouldn't that just give the synchronous effect? > > > > On Mon, Aug 25, 2008 at 6:24 AM, ping2ravi <[EMAIL PROTECTED]> wrote: > > > > > Hi All, > > > > > Does any one know how to make Synchronous calls using GWT. > > > > Currently i am using GWT to build services, creating files like > > > > > com.app.client.MyService.java > > > > //One function in this interface > > > > doMyTask(ParamTpye myparams) throws ClientException; > > > > > com.app.client.MyServiceAsync.java > > > > //One function in this interface > > > > doMyTask(ParamTpye myparams,AsyncCallback callback) throws > > > > ClientException; > > > > > com.app.server.MyServiceImpl.java > > > > //One function in this class > > > > doMyTask(ParamTpye myparams) throws ClientException; > > > > > now i create the service and call > > > > MyServiceAsync userService = (MyServiceAsync) > > > > GWT.create(MyService.class); > > > > ServiceDefTarget endpoint = (ServiceDefTarget) userService; > > > > String moduleRelativeURL = GWT.getModuleBaseURL() + "MyService"; > > > > endpoint.setServiceEntryPoint(moduleRelativeURL); > > > > userService.doMyTask(MyParams,CallBackObject); > > > > > This piece of code is working fine as a ASYNCHRONOUS call. > > > > > Then i tried making is synchronous call using following code(i don't > > > > know if its valid or not) > > > > instead of using MyServiceAsync i am using MyService > > > > > MyService userService = (MyService) GWT.create(MyService.class); > > > > ServiceDefTarget endpoint = (ServiceDefTarget) userService; > > > > String moduleRelativeURL = GWT.getModuleBaseURL() + "MyService"; > > > > endpoint.setServiceEntryPoint(moduleRelativeURL); > > > > userService.doMyTask(MyParams); > > > > > But call to doMyTask throw following exception. > > > > java.lang.ClassCastException in MyService_Proxy. > > > > > So i guess this is not the way to make synchronous call in GWT > > > > Can any one point me how to do that. Or its not possible at all in > > > > GWT. > > > > > Thanks in advance., > > > > Ravi.- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
