0

I am using GWT. In my client side code I am calling service method. With that method i am getting values from database and with that values I am performing some logical operation. What happened is in success method until it completed rest of the code in outer than service method executing. How to block execution code until my success method completes?

Thanks in advance

VijayKumar
  • 11
  • 1
  • 2
  • 5

2 Answers2

1

Move the rest of your code into your success method. If there are many lines then extract them into some new method and just call this method as a last instruction from your success method.

Maksym Demidas
  • 7,707
  • 1
  • 29
  • 36
0

You can either put the "conditional" code in a separate method and call that method in the Receiver#onSuccess() method

Don't forget to implement the onFailure() method to notify the user so doesn't remain waiting infront of his screen.

If your conditional code is application wide, use the EventBus to notify the application components that they can do the job.

Zied Hamdi
  • 2,400
  • 1
  • 25
  • 40