Debugging GWT AsyncCallback issues by adding a timeout

In my GWT code I tend to end up with AsyncCallbacks all over the place so that I can support data which is fetched via RPC in all my widgets.  It seems to be a commonplace issue that I forget to call the callback, which can be quite difficult to diagnose.  To help with that I create a class which “times out” an AsyncCallback.  You wrap your AsyncCallback in this object and then you’ll get an error back if no failure or success comes back in a timely fashion.

http://www.habitsoft.com/public/gwt-async-utils.zip

9 Responses to “Debugging GWT AsyncCallback issues by adding a timeout”

  1. bajistaman Says:

    Hi!, Can you post your class code?

    Thanks,

    Johann

  2. dobes Says:

    Ah yes … for some reason all the code got lost in the post, I seem to be having issues with WordPress. I’ve posted a ZIP file instead.

  3. Mark Says:

    Sorry, I’m a newbie
    I don’t understand how to use your classes,
    what do you intend for ” wrap your AsyncCallback in this object..”
    Thanks!
    Mark

  4. dobes Says:

    By “wrap” I mean you take code that currently does something like:

    myCallback = new AsyncCallback() { … };
    something.doSomeAsyncOperation(myCallback);

    and replace the callback object with a replacement like this:

    myCallback = new AsyncCallback() { … };
    myCallback = new AsyncCallbackWithTimeout(myCallback);
    something.doSomeAsyncOperation(myCallback);

    Since the calls to the original callback are going “through” the timeout class, this is called a wrapper. Hope that helps.

  5. Mark Says:

    It works good
    Thank you for your help

  6. Kazeblize Says:

    Hello, I am interested by your class TimeOut but the link does not work you can show us the class code

    Thank you for advances.

  7. Dobes Vandermeer Says:

    The code is now available as part of the kiyaa project on googlecode.

    http://code.google.com/p/kiyaa/

  8. Kazeblize Says:

    Thank you.

  9. Debty Says:

    Ahaan… I will follow.

Leave a Reply