Exception handling in ThreadPools

后端 未结 6 1981
予麋鹿
予麋鹿 2020-12-23 16:18

I have a ScheduledThreadPoolExecutor that seems to be eating Exceptions. I want my executor service to notify me if a submitted Runnable throws an exception.

For ex

6条回答
  •  半阙折子戏
    2020-12-23 17:12

    Consider adding a static event in your ScheduledThreadPoolExecutor class that any of your tasks can call if an exception is thrown. That way, you can leverage that event to capture and handle the exceptions that occur within your threads.

提交回复
热议问题