developerinlondon
Programmer
The scenario is this.
a servlet creates x many threads to fetch certain documents from different locations. The servlet waits a fixed number of seconds for them to finish, if they dont finish the servlet will destroy any unfinished threads and die.
what would be the best way to do this?
I was thinking of putting all the children threads under a threadgroup and after creating all threads to sleep for the designated number of seconds, destroy all threads in the threadgroup and die. it seems destroy method is depricated in the new JDK.
I am trying to do this so that I dont have any dead threads lying around in tomcat, I always seem to be getting lots of threads hanging around doing nothing from during peak times.
a servlet creates x many threads to fetch certain documents from different locations. The servlet waits a fixed number of seconds for them to finish, if they dont finish the servlet will destroy any unfinished threads and die.
what would be the best way to do this?
I was thinking of putting all the children threads under a threadgroup and after creating all threads to sleep for the designated number of seconds, destroy all threads in the threadgroup and die. it seems destroy method is depricated in the new JDK.
I am trying to do this so that I dont have any dead threads lying around in tomcat, I always seem to be getting lots of threads hanging around doing nothing from during peak times.