...
This compliant solution sets an uncaught exception handler on behalf of the thread pool. During its construction, an An argument of type ThreadFactory
is passed to the thread pool while constructing it. The factory is responsible for creating new threads and setting the uncaught exception handler on their behalf. The class Task
remains the same as the noncompliant code example.
...