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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user