|
53 | 53 | import org.springframework.data.redis.core.StringRedisTemplate; |
54 | 54 | import org.springframework.data.redis.core.script.DefaultRedisScript; |
55 | 55 | import org.springframework.data.redis.core.script.RedisScript; |
56 | | -import org.springframework.data.redis.listener.ChannelTopic; |
| 56 | +import org.springframework.data.redis.listener.PatternTopic; |
57 | 57 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
58 | 58 | import org.springframework.data.redis.listener.Topic; |
59 | 59 | import org.springframework.integration.support.locks.DistributedLock; |
|
97 | 97 | * @author Alex Peelman |
98 | 98 | * @author Youbin Wu |
99 | 99 | * @author Michal Domagala |
| 100 | + * @author Severin Kistler |
100 | 101 | * |
101 | 102 | * @since 4.0 |
102 | 103 | * |
@@ -213,7 +214,7 @@ private void setupUnlockMessageListener(RedisConnectionFactory connectionFactory |
213 | 214 | "'unlockNotifyMessageListener' must not have been re-initialized."); |
214 | 215 | RedisLockRegistry.this.redisMessageListenerContainer = new RedisMessageListenerContainer(); |
215 | 216 | RedisLockRegistry.this.unlockNotifyMessageListener = new RedisPubSubLock.RedisUnLockNotifyMessageListener(); |
216 | | - final Topic topic = new ChannelTopic(this.unLockChannelKey); |
| 217 | + final Topic topic = new PatternTopic(this.unLockChannelKey + ":*"); |
217 | 218 | RedisMessageListenerContainer container = RedisLockRegistry.this.redisMessageListenerContainer; |
218 | 219 | RedisPubSubLock.RedisUnLockNotifyMessageListener listener = RedisLockRegistry.this.unlockNotifyMessageListener; |
219 | 220 | container.setConnectionFactory(connectionFactory); |
@@ -690,7 +691,7 @@ protected boolean tryRedisLockInner(long time, long expireAfter) |
690 | 691 | protected boolean removeLockKeyInnerUnlink() { |
691 | 692 | return Boolean.TRUE.equals(RedisLockRegistry.this.redisTemplate.execute( |
692 | 693 | UNLINK_UNLOCK_REDIS_SCRIPT, Collections.singletonList(this.lockKey), |
693 | | - RedisLockRegistry.this.clientId, RedisLockRegistry.this.unLockChannelKey)); |
| 694 | + RedisLockRegistry.this.clientId, RedisLockRegistry.this.unLockChannelKey + ":" + this.lockKey)); |
694 | 695 | } |
695 | 696 |
|
696 | 697 | private boolean subscribeLock(long time, long expireAfter) throws ExecutionException, InterruptedException { |
|
0 commit comments