Noor
Noor

Reputation: 20150

GWT make RPC blocking

Is it possible to make a gwt rpc blocking? i.e. the application blocks until a response is received from the server

Upvotes: 1

Views: 5905

Answers (3)

Hons
Hons

Reputation: 4046

The most simple solution that came to my mind would be to "block" your application from the point where the Asynchronous call starts till the filling is completed, which would be at the end of the onSuccess() method.

By blocking I mean just to show some animated loading gif in the middle of the page.

Upvotes: 0

Gursel Koca
Gursel Koca

Reputation: 21300

Well, synchronus rpc calls are called as evils by GWT designers. They do have very strong arguments... But you can succeed synchronous rpc by means of hacks..Here is one of them, http://code.google.com/p/google-web-toolkit/issues/detail?id=4898

Upvotes: 1

user467871
user467871

Reputation:

As far as I know there is no gwt rpc blocking because it is opposite idea to the asynchronous callback.

But you can use these two methods

  1. Timer. Count timer and check that there is any return object that is not null and stop and cancel timer and continue your job. If timer is active don't do other job. This is very very inefficient way. Lack of OO design pattern and too many if-else-if statements
  2. Call Rpc and do all actions in onSuccess() method. It guarantees that your method is finished and successfully finished then continue to other methods.

My advise is 2nd one (onSuccess). I want to mention again that blocking is never a good idea

Upvotes: 4

Related Questions