Closed
Description
It is good practice to restore the interrupted flag of the current thread when InterruptedException
cannot be thrown.
From Java Concurrency in Practice1:
Sometimes you cannot throw
InterruptedException
, for instance when your code is part of aRunnable
. In these situations, you must catchInterruptedException
and restore the interrupted status by calling interrupt on the current thread
The provided backoff policies (e.g. FixedBackOffPolicy
, ExponentialBackOffPolicy
) throw a BackOffInterruptedException
without restoring the flag.
Do you think it is possible to restore the flag before throwing the runtime exception?
I can open a PR.
Thank you!