S
snae
Hi,
I have an app that spawns a new Thread for several identical tasks that it
needs to carry out. These tasks should never stop running and if they do
I want to take action.
I have looked at two methods of doing this. Using ThreadGroup and
assigning each of the Threads to a ThreadGroup, then looping over the
contents of the ThreadGroup to check if each Thread is running. The other
method is simply to dump each Thread object into an ArrayList and loop
over the contents of this. Either way I would have thought would do the
trick - but which way is 'better'?
The other question I have is - if a Thread stops execution, and is stored
in one of the ways above, does the object persist?. I need to be able to
restart a dead Thread, or at least get some information from that Thread
in order to start a new Thread with the correct information.
Thanks for any help.
I have an app that spawns a new Thread for several identical tasks that it
needs to carry out. These tasks should never stop running and if they do
I want to take action.
I have looked at two methods of doing this. Using ThreadGroup and
assigning each of the Threads to a ThreadGroup, then looping over the
contents of the ThreadGroup to check if each Thread is running. The other
method is simply to dump each Thread object into an ArrayList and loop
over the contents of this. Either way I would have thought would do the
trick - but which way is 'better'?
The other question I have is - if a Thread stops execution, and is stored
in one of the ways above, does the object persist?. I need to be able to
restart a dead Thread, or at least get some information from that Thread
in order to start a new Thread with the correct information.
Thanks for any help.