There's more...

The InterruptedException exception is thrown by some Java methods related to a concurrency API, such as sleep(). In this case, this exception is thrown if the thread is interrupted (with the interrupt() method) when it's sleeping.

Get Java 9 Concurrency Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.