What is the best approach to handling exceptions thrown in a separate thread?

后端 未结 2 608
别那么骄傲
别那么骄傲 2020-12-30 17:12

I am working on a J2ME project that spawns worker threads for numerous tasks such as downloading HTTP content. The basic thread layout is similar to most java apps--there is

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-30 17:42

    Another option other than what Stuph has given is to set exceptions in the thread local. If another exception happens before that exception is cleared then an assert occurs. That at least gives someone a chance to notice the exception and process it.

提交回复
热议问题