Originally posted by Joanne Neal:
Rob - I assume that index and i were intended to be the same variable.
The problem with that approach is that, if the objects are processed faster than they are added to the list, index could become equal to the size of the loop, the while loop will finish and then more objects could be added to the list.
A blocking queue of some sort is probably a better solution.
Yes, index and i should be one and the same. Guess I missed one when replacing.
You're right that BlockingQueue would be better. To be honest, I'm not that familiar with that entire package - I never had to use any of it, or if I did I probably implemented it using
Java 1.4 mechanisms.