Jonathan Hawkes wrote:

Speaking of explicit time slicing...  What about something like the
following?  and then a modified Executor?  A thread pool could execute one
step of the iteration and then requeue the loop until it was complete.
Loop.beforeRun is called with the Thread that the current iteration will be
executed on.

It's not really necessary. I did something along these lines with a "Wizard" type of Command. It used reflection to determine the number of steps, therefore the number of repeats. All the user had to do was implement the following:

class MyWizard extends AbstractWizard
{
    public void step1() throws Exception
    {
        //perform step
    }
    public void step2() throws Exception
    {
        //perform step
    }
    public void step3() throws Exception
    {
        //perform step
    }
    public void step4() throws Exception
    {
        //perform step
    }
}

It works pretty well.  The AbstractWizard also provides some methods to reset
the wizard so that it can be re-used, and go back to the starting position if
one of the steps had to be finished early.

It's pretty easy to do.

--

"They that give up essential liberty to obtain a little temporary safety
 deserve neither liberty nor safety."
                - Benjamin Franklin


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to