Fix LockRegLeaderInitiator for interrupted Thread

https://build.spring.io/browse/INT-MASTER-1024

When the Lettuce Redis client catches an `InterruptedException`, it is
wrapped to the `RedisCommandInterruptedException`, therefore when we
catch an exception on our code level it is not an `InterruptedException`
anymore and we can't proceed in the loop because the tread is
`interrupted` already.

* Check the `interrupted` alongside with the `InterruptedException`
to restart a loop from a fresh thread.

**Cherry-pick to 5.0.x**
This commit is contained in:
Artem Bilan
2018-05-07 14:09:36 -04:00
parent a14514ada0
commit fc47952459

View File

@@ -398,7 +398,7 @@ public class LockRegistryLeaderInitiator implements SmartLifecycle, DisposableBe
}
}
if (e instanceof InterruptedException) {
if (e instanceof InterruptedException || Thread.currentThread().isInterrupted()) {
Thread.currentThread().interrupt();
if (isRunning()) {
logger.warn("Restarting LeaderSelector because of error.", e);