ThreadFactory usage in Java

前端 未结 10 1908
旧巷少年郎
旧巷少年郎 2020-12-02 05:08

Can someone briefly explain on HOW and WHEN to use a ThreadFactory? An example with and without using ThreadFactory might be really helpful to understand the differences.

10条回答
  •  时光说笑
    2020-12-02 05:48

    Take a look at VerboseThreads (implements ThreadFactory) from jcabi-log. This implementation makes Threads that log exceptions when they are being thrown out of them. Very useful class when you need to see when and why your threads die.

提交回复
热议问题