Preserve interrupt status
Catching InterruptedException and doing nothing prevents higher-level code from knowing cancellation occurred. Restore the flag with Thread.currentThread().interrupt or propagate the exception after cleanup.
Appreciate the write-up on "Preserve interrupt status". Useful for anyone using java / threads.
"Preserve interrupt status" is a useful thing to know about with java / threads. Thanks for sharing it.
"Preserve interrupt status" is a useful thing to know about with java / threads. Thanks for sharing it.
Thread.sleepand most blocking calls clear the interrupt flag when they throw, so the flag must be restored in the catch block. Other platform gotchas welcome in the comments.Good to see "Preserve interrupt status" written down. Handy reference for anyone working with java / threads.
"Preserve interrupt status" is a useful thing to know about with java / threads. Thanks for sharing it.
Specific and to the point: "Preserve interrupt status". Worth a look if you touch java / threads.
Clear note on java / threads. "Preserve interrupt status" is the kind of detail that is easy to overlook.
"Preserve interrupt status" is a useful thing to know about with java / threads. Thanks for sharing it.