Look at ThreadPoolExecutor awaitTermination. Does that do what you need?
There are some other ways. I did exactly what you did before I found join(). This technique loses the benefits of your
thread pool if you have more tasks than you'd like to have run all at once.
FutureTask is a bit cleaner than that because you don't have to touch the Threads. You could pass a bunch of FutureTasks to an executor and then call get() on each one.
Now you can control the number of threads working at the same time and reuse them if necessary.
Any of that sound good?
[ June 16, 2007: Message edited by: Stan James ]