Alright, I understand the concept. But I think I need a basic code
example to help me on my way. I set up my "Command" actions and
everything works fine. What I don't get is how to pass the command
back once AsyncCallback returns.
This is an example of how my command currently looks. This works but
all the commands a launched almost synchronously which is normal. So
when the onSuccess method is called. How do I get it to return itself
and add the next command in the queue? I feel dumb.
public void execute() {
System.out.println("EXECUTING ACTION");
Timer wTimer = new Timer() {
@Override
public void run() {
service.sendSshCommand(
instanceRow.getInstanceInfo().getHost(),
instanceRow.getActionCommand(),
instanceRow.getEnvironment().isProdMode(),
new AsyncCallback() {
public void onFailure(
Throwable caught ) {
System.err.println("FAIL: " + caught);
}
public void onSuccess( Object
result ) {
System.out.println("Success: " + (String)result);
}
});
}
};
if ( delay > 0 ) {
System.out.println("Delay: " + delay + " seconds.");
wTimer.schedule( delay * 1000 );
} else {
wTimer.schedule( 0 );
}
}
On Oct 1, 4:45 am, Ed <[EMAIL PROTECTED]> wrote:
> What Thomas mentions works fine.
> I do the same: have a dispatcher that dispatches events.
> When a subscriber/listener indicates in the dispatched event that the
> dispatcher needs to wait dispatching any further event, the dispatcher
> queues all following events and waits untill it gets a signal from the
> subscriber (through the same event) that it is finished and that the
> dispatcher may continue dispatching.
> I use this a lot to load CMS content and other stuff at the start of
> the application.
>
> Additional delay's can then easily be added with the GWT Timer.
>
> -- Ed
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---