Threading is easy in Java, but today I was reminded of another of its pitfalls.
In Java- or container-provided threads, unhandled exceptions from our code will be printed or logged to the console. Create your own
Thread or use
ThreadPoolExecutor, and it’s a different story..
Threaded code tends to die silently. Nothing on the console or logs. Unhandled exceptions are invisible, and leave very few clues. Let’s look at why.