On the other hand I am thinking, is the activity really destroyed, if there
is already an active RPC listener?
That is an external reference to the Activity object so the GC would not
touch it, right?


On 11/24/12 4:22 PM, "Alexey Panteleev" <ale...@yoxel.com> wrote:

> Ok, I think it's a good idea for me to switch to the Activity/Places framework
> on this project also.
> So the things like that are handled by the framework automatically.
> 
> Supercobra is actually saying I wont have to worry about setting that isActive
> flag as the Activity will get destroyed all together.
> 
> On Saturday, November 24, 2012 10:44:11 AM UTC-8, Jens wrote:
>> If you see SQLExceptions just because the user navigates too quickly you
>> should analyse and fix your server code / database setup / querys!
>> 
>> When you have solved this your only "problem" now is that both RPC callbacks
>> will be executed once their corresponding RPC request returns and this may
>> cause odd behavior in your UI if not handled. You have to detect when a user
>> leaves a page and store that fact in a field (e.g. boolean isActive). Your
>> callback should then check this field before executing its onSuccess() code.
>> 
>> Using GWT Activities you would set the flag to true in Activity.start() and
>> to false in Activity.stop() and Activity.cancel().
>> 
>> Following the documentation for GWT-RPC you could also let your methods
>> return "Request" instead of "void", e.g.
>> interface MyServiceAsync {
>>   public Request myMethod(String s, AsyncCallback<String> callback);
>> }
>> this allows you to cancel the request on the client side (server will still
>> do its work once the request reaches the server).
>> 
>> -- J.
>> 
>> 
>> 
>> Am Freitag, 23. November 2012 19:04:13 UTC+1 schrieb Alexey Panteleev:
>>> Hello,
>>> 
>>>  I've been struggling with this issue for a long time, maybe someone could
>>> help me address this finally?
>>> From time to time it happens that a user navigates to one page wich issues
>>> an RPC to our server but then quickly navigates to another page which issues
>>> yet another RPC to the server while the 1st call is still being processed by
>>> the server. In this case I always see some kind of SQLException on the
>>> server side (I guess for the 1st call) and then the client also receives an
>>> unspecified Exception.
>>> 
>>>  What is the best practice for dealing with these situations? Should I be
>>> canceling the 1st call before allowing the 2nd one?
>>> We use gwt-dispatch, I did not find  a cancel method in that framework yet.
>>> Or should I not allow any new calls until the active one has not finished?
>>> 
>>>  Do you ever run into this w/ GWT?
>>> 
>>> Thanks much,
>>> Alexey

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to