Monday, November 29, 2010

Request.cancel doesn't work for me!


I'm working on an GWT-App displaying a map with different layers.
Some of those layers are drawn just on request and just for the part
of the map which is currently displayed.

The Problem occurs if a user moves and zooms the map pretty fast, so
that a lot of pictures have to be drawn. This results in quite a time
of waiting when he finally stops. What I tried was to cancel the
request using Request.cancel (the Async Method returns Request instead
of void), but all the pictures are drawn anyway.

How does the Request.cancel-method work? Is it just blocking the
Callback? Or does it actually cancel the running code on server-side?
Maybe the problem is, that the specific method contains mainly one
complex method-call? The specific method-scheme looks like:

public Boolean update() {
int a = 2;
int b = 3;

int x = imExpensive(a,b); // method which needs like 95% of
calculating time

if (x>0) return true;
return false;

I suppose that the Request.cancel-method does not cancel a running
method, and stops the method right after imExpensive(). Is that right?
In that case the problem could be solved by making the method
imExpensive less complex, which would be a pretty doable task ...

Thanks a lot!

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment