On Mon, 2008-09-15 at 16:34 -0400, Ryan McKinley wrote:
> I'm trying to follow the Droids lifecycle...
>
> In the current implementation, it appears that a new Worker is created
> to run every Task
One worker, one thread and one task, yes.
>
> Strangely, the Worker seems to get its Task when the Queue is set:
>
> public void setQueue(Queue queue) {
> synchronized (this) {
> this.queue = queue;
> link = getQueue().next();
> if (link != null) {
> depth = link.getDepth();
> }
> }
> }
>
> Is this really the best model to use?
The worker needs access to the queue because it can extract new task
that have to go back to the queue.
If you have another approach that may work better I am open for
suggestions.
>
> (I know "anything is possible", but the example crawlers/walkers
> should share best practice code that can be extended and hopefully
> never revisited)
Agree till the part of never review. Best practice develops with time.
>
> If a Worker is going to pull tasks off the Queue, should it do so in
> the run()? Also, I don't follow what happens when the Queue is empty.
>
The invocation of a new worker depends that the queue is not empty. If
empty no new worker will be called.
salu2
--
Thorsten Scherler thorsten.at.apache.org
Open Source Java consulting, training and solutions
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]