Re: Create custom callbacks to achieve synchronous code execution

2011-10-11 Thread Alexander Orlov
Thx a lot! Pretty much what I've looked for! -- 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/-/58zGUENhpooJ. To post to this group, send email to

Create custom callbacks to achieve synchronous code execution

2011-10-04 Thread Alexander Orlov
It seems that Dev Mode code runs synchronously... Otherwise I can't explain a bug that occurs only in production mode where the results are already there before a table has been cleaned to receive those new results and still has its outdated results. So both are mixed, although I call

[SOLUTION] Re: Create custom callbacks to achieve synchronous code execution

2011-10-04 Thread Alexander Orlov
Use code like: RunAsyncCallback getResourceItems = new RunAsyncCallback() { @Override public void onFailure(Throwable reason) { GWT.log(reason.getMessage()); } @Override public void onSuccess() { System.out.println(THIRD);

Re: Create custom callbacks to achieve synchronous code execution

2011-10-04 Thread Ashton Thomas
Hey Alexander, I am not sure you are going about this the correct way. Dev Mode is NOT synchronous and it functions just like production mode. There is another reason why you are getting your results. It may be because the requests take longer in Dev Mode and your client has time to send the

Re: Create custom callbacks to achieve synchronous code execution

2011-10-04 Thread Alexander Orlov
On Tue, Oct 4, 2011 at 5:59 PM, Ashton Thomas ash...@acrinta.com wrote: Hey Alexander, I am not sure you are going about this the correct way. Dev Mode is NOT synchronous and it functions just like production mode. There is another reason why you are getting your results. It may be because the

Re: [SOLUTION] Re: Create custom callbacks to achieve synchronous code execution

2011-10-04 Thread Jens
You shouldn't use this solution. GWT.runAsync is used to create a code split point and not to execute things asynchronously. As far as I know these code split points act synchronously in dev mode but asynchronous in production/compiled mode. I think this is because in dev mode there are no .js

Re: [SOLUTION] Re: Create custom callbacks to achieve synchronous code execution

2011-10-04 Thread Alexander Orlov
On Tue, Oct 4, 2011 at 6:37 PM, Jens jens.nehlme...@gmail.com wrote: You shouldn't use this solution. GWT.runAsync is used to create a code split point and not to execute things asynchronously. I don't want to execute things asynchronously. I want to execute things * synchronously*. As far

Re: Create custom callbacks to achieve synchronous code execution

2011-10-04 Thread Ashton Thomas
My understanding is that the simple solution below would work. Is this correct? service.getStuff(new AsyncCallbackThisThat(){ public void onSuccess(result){ updateStuff(result); } } public void updateStuff(ThisThat obj){ //execute A //execute B } -- You received this message

Re: [SOLUTION] Re: Create custom callbacks to achieve synchronous code execution

2011-10-04 Thread Jens
Yeah ok maybe I missunderstood your solution example. But your general idea is correct: 1.) do the first async request 2.) in the callbacks onSuccess method of the first request execute the second async request. So basically you are chaining async requests. Thats the way to go, or try to fix

Re: Create custom callbacks to achieve synchronous code execution

2011-10-04 Thread Alexander Orlov
On Tue, Oct 4, 2011 at 6:53 PM, Ashton Thomas ash...@acrinta.com wrote: My understanding is that the simple solution below would work. Is this correct? service.getStuff(new AsyncCallbackThisThat(){ public void onSuccess(result){ updateStuff(result); } } public void

Re: [SOLUTION] Re: Create custom callbacks to achieve synchronous code execution

2011-10-04 Thread Alexander Orlov
On Tue, Oct 4, 2011 at 7:53 PM, Jens jens.nehlme...@gmail.com wrote: Yeah ok maybe I missunderstood your solution example. But your general idea is correct: 1.) do the first async request 2.) in the callbacks onSuccess method of the first request execute the second async request. So

Re: Create custom callbacks to achieve synchronous code execution

2011-10-04 Thread Jens
What I sometimes do is to provide a callback parameter for methods that do async requests if I want to be notified once the async request finishes. So basically: void executeAllTheseStuff() { doAsyncStuff(new Callback() { @Override public void onSuccess() {