Skip to content

Commit 25e1b73

Browse files
committed
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** (cherry picked from commit fc47952)
1 parent 4d8494a commit 25e1b73

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ else if (acquired) {
398398
}
399399
}
400400

401-
if (e instanceof InterruptedException) {
401+
if (e instanceof InterruptedException || Thread.currentThread().isInterrupted()) {
402402
Thread.currentThread().interrupt();
403403
if (isRunning()) {
404404
logger.warn("Restarting LeaderSelector because of error.", e);

0 commit comments

Comments
 (0)