Blocking methods in Java often declare they may throw InterruptedException. How should we handle it?
In this article, Brian Goetz explains why rethrowing it is usually the most correct approach.
Blocking methods in Java often declare they may throw InterruptedException. How should we handle it?
In this article, Brian Goetz explains why rethrowing it is usually the most correct approach.
Exception handling in Java is crucial for reliability, but a common source of bloat & prone to miscoding. However, dealing with exceptions correctly can be surprisingly easy.
We cover 10 “foundation” best practices to simplify your coding & help you handle exceptions correctly. Continue reading
Checked exceptions have always been a controversial feature of the Java language.
Advocates claim they ensure checking & recovery from failures. Detractors say “catch” blocks can almost never recover from an exception, and are a frequent source of mistakes.
Meanwhile, Java 8 and lambdas are here. Are checked exceptions becoming obsolete in the Java world? Continue reading
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 SwingWorker
/ 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.