Re: Is there any method by which I can join() to a group of threads instead of a single one?
Posted By:
Anonymous
Posted On:
Friday, April 27, 2001 12:06 AM
I recommend that you subclass ThreadGroup and then create one (or more) join-methods in that class.
When the join method is called just iterate and join the threads in the threadgroup.
public class ExtendedThreadGroup extends ThreadGroup{
public ExtendedThreadGroup(String aName){
super(aName);
}
public ExtendedThreadGroup(String aName, ThreadGroup
aThreadGroup){
super(aName,aThreadGroup);
}
public void join(){
Thread threads[];enumerate(threads);
for(int i= 0;i
threads[i].join();
}
}
Thats IT ;)