多线程程序中要注意捕获java.lang.ThreadDeath

    它的API DOC中写着:

   The top-level error handler does not print out a message if ThreadDeath is never caught.

    如果你的各个线程相继死去,并且没有报错,那很有可能就是这个东西引起的

   程序应该在run()方法内部捕捉这个异常,才能保证Thread不死

   Tomcat容器会捕获这个错误

   如果在Eclipse内执行某个程序,也会捕获这个错误

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.