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

Advertisements

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. 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.

%d bloggers like this: