schedule an action for next idle time???

81 views
Skip to first unread message

Magnus

unread,
Mar 23, 2012, 1:39:48 PM3/23/12
to Google Web Toolkit
Hello,

I need to execute some code *after* all pending rpc calls have
terminated, e. g.:

...
void onModuleLoad()
{
doRPCcalls();

scheduledAction();
}

void scheduledAction()
{
Window.alert("This should be called after all RPC calls have
terminated");
}

I want to avoid placing the scheduled actions somewhere in the
onSuccess method of the RPC call. I just want to say "do this when the
current tasks are done".

Can I do this somehow?

Thanks
Magnus

Jens

unread,
Mar 23, 2012, 2:28:06 PM3/23/12
to google-we...@googlegroups.com
I would say your only choice is to count all active/pending RPC calls, along with firing an IdleEvent (counter == 0) and BusyEvent (counter > 0) on the event bus. How you easily count RPC calls somehow depends on your current app design. 

If you use RequestFactory you can probably use a custom RequestTransport implementation that counts pending requests. 

For GWT-RPC you probably have to wrap each RPC service in an additional class (which implements your service interface and delegates to the real service) so you can add additional functionalities (e.g. counting) when doing RPC method calls. 

-- J.

Thomas Broyer

unread,
Mar 24, 2012, 7:01:54 AM3/24/12
to google-we...@googlegroups.com


On Friday, March 23, 2012 7:28:06 PM UTC+1, Jens wrote:
I would say your only choice is to count all active/pending RPC calls, along with firing an IdleEvent (counter == 0) and BusyEvent (counter > 0) on the event bus. How you easily count RPC calls somehow depends on your current app design. 

If you use RequestFactory you can probably use a custom RequestTransport implementation that counts pending requests. 

For GWT-RPC you probably have to wrap each RPC service in an additional class (which implements your service interface and delegates to the real service) so you can add additional functionalities (e.g. counting) when doing RPC method calls. 

For GWT-RPC, you can use a RpcRequestBuilder. 

Magnus

unread,
Mar 25, 2012, 11:28:03 AM3/25/12
to google-we...@googlegroups.com
Am Samstag, 24. März 2012 12:01:54 UTC+1 schrieb Thomas Broyer:

For GWT-RPC, you can use a RpcRequestBuilder. 

Hi Thomas,

thank you! Can you give a link to a tutorial/documentation on how to do this?
I can only find the API docs, but these are not self-explanatory...

Magnus 
Reply all
Reply to author
Forward
0 new messages