From 07085a17ae3baef39e00d4f016de36b84aa9ece3 Mon Sep 17 00:00:00 2001 From: alexpeelman Date: Tue, 20 Aug 2024 18:08:48 +0200 Subject: [PATCH] GH-9401: RedisLockRegistry: use `lock()` instead of `tryLock()` for lifecycle Fixes: #9401 Switched `tryLock()` with `lock()` in `RedisLockRegistry.runRedisMessageListenerContainer()` method for correct synchronization. **Auto-cherry-pick to `6.3.x` & `6.2.x`** --- .../integration/redis/util/RedisLockRegistry.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/util/RedisLockRegistry.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/util/RedisLockRegistry.java index 1b420adea7f..d5eb18b900e 100644 --- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/util/RedisLockRegistry.java +++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/util/RedisLockRegistry.java @@ -87,6 +87,7 @@ * @author Eddie Cho * @author Myeonghyeon Lee * @author Roman Zabaluev + * @author Alex Peelman * * @since 4.0 * @@ -658,7 +659,7 @@ private boolean subscribeLock(long time) throws ExecutionException, InterruptedE } private void runRedisMessageListenerContainer() { - RedisLockRegistry.this.lock.tryLock(); + RedisLockRegistry.this.lock.lock(); try { if (!(RedisLockRegistry.this.isRunningRedisMessageListenerContainer && RedisLockRegistry.this.redisMessageListenerContainer != null