Hi, I have seven to ten threads running at a time in my Application. Some database processing is done in each Thread and time it takes to finish is different for each Thread. I have ProgressBar for each Thread to keep track of when the Thread completes and shows a message on the ProgressBar saying Thread finished . Now my problem is if any Thread throws OutOfMemory error then all my threads keep going but never finishes means it goes in some kind of continuous looping effect. And my ProgressBars keeps going forever. Now my question is Is there a nice way to catch this error and do some clean up and kill a Thread while letting other Threads to keep continue and finish properly. What happens to a Thread if OutOfMemory error occurs. Thanks for any tips and help.
Originally posted by hallian: Is there a nice way to catch this error and do some clean up and kill a Thread while letting other Threads to keep continue and finish properly.
To me an out-of-memory error implies a logic error. Without any memory left, JVM will crash because there is nothing left to run. Instead of catching it and ignoring it, I would try to fix the cause. If the cause is the number of threads generated then you can increase memory or limit the threads.
Originally posted by hallian: What happens to a Thread if OutOfMemory error occurs.
Will it be captured by UFO? [ September 24, 2002: Message edited by: Doanh Nguyen ]
"hallian", Thanks for participating here at the Ranch. However, the name you are using does not comply with our naming convention described at http://www.javaranch.com/name.jsp . Please log in with a new name, which meets these requirements. You can change your name here. Thanks. Sean