On 29 sep, 17:49, "Peter D." <[EMAIL PROTECTED]> wrote:
> I've read a few posts on here on how to delay loops and such using
> Timers but I am unsure if they fit with my particular needs. I am
> writing a feature for a GWT app I inherited that controls application
> server states. (e.g. Start/Stop/Restart etc). I thought it would be a
> cool idea to allow the users to set delays between each command sent
> to the app server.
>
> Example:
>
> SERVER1 - RESTART
> DELAY 15 SECONDS
> SERVER2 - RESTART
> DELAY 15 SECONDS
> ...
>
> The problem I am having is with the delaying. Using a Timer would not
> work because the timers return instantly when you set them on a
> schedule. So any servers set with an action below any timers would
> start right away. And all delay timers would start almost at the same
> time.
>
> The functionality I want is to be able to go through that list and do
> each action one by one. Send restart server 1 command, delay 15
> seconds, send restart server 2 command, delay 15 seconds, etc...
>
> I would appreciate any suggestions or insights on this problem, thank
> you.
Push "commands" into a queue.
Commands are all asynchronous ("server restart" might be synchronous
if you don't wait for a response that the restart order has been
received and taken into account), so you'll wait for the command to
complete before launching the following one.
In a few word:
- each command would know how to run and report completeness
(AsyncCallback for RPCs, RequestCallback for RequestBuilder, an
interface of your choice for Timers that'd be called from the Timer's
run() method)
- your callback passed to each command's "run()" method simply
dequeue and run and the next command, passing itself as the callback
(to dequeue and run the next command, etc.)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---