Multiple thread handle problem  
Author Message
ankur





PostPosted: 2003-12-14 21:46:00 Top

java-programmer, Multiple thread handle problem hi

I am starting a no.of threads(500) from my application. i want to
start a new thread as soon as one of these threads dies.Any of the
thread could die at any particular time.Currently i am using a loop
to check which of the threads is alive and i can use join() for
others.I don't want to use a loop as that is eating a lot of memory.

Using synchronization method is it possible to block (creation of new
thread) untill one of the current thread dies.

Please help...

Anks
 
HGA03630





PostPosted: 2003-12-15 8:50:00 Top

java-programmer >> Multiple thread handle problem email***@***.com (anks) wrote in message news:<email***@***.com>...
> hi
>
> I am starting a no.of threads(500) from my application. i want to
> start a new thread as soon as one of these threads dies.Any of the
> thread could die at any particular time.Currently i am using a loop
> to check which of the threads is alive and i can use join() for
> others.I don't want to use a loop as that is eating a lot of memory.
>
> Using synchronization method is it possible to block (creation of new
> thread) untill one of the current thread dies.
>
> Please help...
>
> Anks

Don't create thread directly. Make a thread pool as a singleton and
let user who need new thread retrieve his thread from the pool.