I’m using Java 6.
Suppose I create 100 threads, each to complete one task. I want to run 10 threads at a time continuously. This means that if I was running thread 1-10, and thread 8 finishes, I want to be able to start thread 11 right away, without waiting for 1-10 to join.
How can I do this?
One way around this is probably using the isAlive() method, but I was wondering if I can do this without polling.
Thanks.
Why do you need to do it?
The better way would be to create a pool of 10 threads and submit 100 tasks into it. It will have exactly the same effect – 10 of 100 tasks are running simultaneously.