posted 21 years ago
Hi.
Please excuse my poor knowledge, in case u already tried what I will suggest.
1. A thread can die suddenly most probably because there was a RuntimeException (NullPointerException, NumberFormatException, etc) inside run() method.
I would suggest you to write this :
public void run(){
try{
//business logic
}catch(Throwable t){
Log.log(log_trace,t.toString());
}
}
Hope this might help u.
2. On the other hand, from my poor knowledge, ThreadGroup class is not worth it.
When you use threadgroup , u start threads. starting a thread is pretty much slower than having the threads in a pool. U use ThreadGroup because probably u are interested in knowing when all those threads have stopped, and u'll have to do a loop (with sleep in it) to see how many active threads are inside this ThreadGroup. You can put this very easy (with a lot of code, of course) with a pool of threads, and would be a lot more faster (because of the pool and because when all those threads have finished a cycle in run -in run u have an endless loop, from which u can exist only when u want- u'll get a notify).
Hope u got what I said here, and, again, please excuse my poor knowledge in case I misslead u in any way.
Best regards, Tibi.
Best regards, Tibi.