Fix LockRegLeaderIn for interrupted Thread.sleep (#2455)
* Fix LockRegLeaderIn for interrupted Thread.sleep https://build.spring.io/browse/INT-FATS5IC-517 If current thread is interrupted, the `Thread.sleep()` interrupts immediately. In the catch block of the main loop in the `LockRegistryLeaderInitiator` we have such a dangerous `sleep()` and don't restart election in this candidate any more * Move `Thread.sleep()` to else after checking the current thread for interrupted state * Remove `LongRunningIntegrationTest` rule from the `RedisLockRegistryLeaderInitiatorTests` since it now works much faster after proper `busy-wait` handling **Cherry-pick to master** * Ignore interruption on the sleep i catch and move on with loop
This commit is contained in:
committed by
Gary Russell
parent
7ab024df88
commit
c9faf3c8ce
@@ -37,7 +37,6 @@ import org.springframework.integration.redis.rules.RedisAvailableTests;
|
||||
import org.springframework.integration.redis.util.RedisLockRegistry;
|
||||
import org.springframework.integration.support.leader.LockRegistryLeaderInitiator;
|
||||
import org.springframework.integration.test.rule.Log4j2LevelAdjuster;
|
||||
import org.springframework.integration.test.support.LongRunningIntegrationTest;
|
||||
import org.springframework.scheduling.concurrent.CustomizableThreadFactory;
|
||||
|
||||
/**
|
||||
@@ -49,9 +48,6 @@ import org.springframework.scheduling.concurrent.CustomizableThreadFactory;
|
||||
*/
|
||||
public class RedisLockRegistryLeaderInitiatorTests extends RedisAvailableTests {
|
||||
|
||||
@Rule
|
||||
public LongRunningIntegrationTest longTests = new LongRunningIntegrationTest();
|
||||
|
||||
@Rule
|
||||
public Log4j2LevelAdjuster adjuster =
|
||||
Log4j2LevelAdjuster.trace()
|
||||
|
||||
Reference in New Issue
Block a user