I have a program that starts several new threads, all of which loop infinitely, each taking time to sleep between execution of it's own code. My question is this- If I name the threads from my main "hub" (the program which starts all the threads), is there a way for me to use the Thread name to verify whether or not that that thread is still running after x amount of time?
Joined: Mar 05, 2003
Would the Thread methods getName() and isAlive() serve your purpose? [ June 24, 2003: Message edited by: Marlene Miller ]
Joined: Jan 30, 2000
Your "hub" thread could just store an ArrayList or something containing references to the threads it has created. Then later you can loop through the list and check isAlive() on each one. I don't think you need the name for this, but maybe you will want to assign meaningful names for readability or something.