Search code examples
javagwtgwt-rpc

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


Solution

  • 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