23
23
import java .util .ConcurrentModificationException ;
24
24
import java .util .Date ;
25
25
import java .util .LinkedHashMap ;
26
+ import java .util .List ;
26
27
import java .util .Map ;
27
28
import java .util .Map .Entry ;
28
29
import java .util .UUID ;
@@ -668,7 +669,7 @@ private final class RedisPubSubLock extends RedisLock {
668
669
private static final String UNLINK_UNLOCK_SCRIPT = """
669
670
local lockClientId = redis.call('GET', KEYS[1])
670
671
if (lockClientId == ARGV[1] and redis.call('UNLINK', KEYS[1]) == 1) then
671
- redis.call('PUBLISH', ARGV [2], KEYS[1])
672
+ redis.call('PUBLISH', KEYS [2], KEYS[1])
672
673
return true
673
674
end
674
675
return false
@@ -689,9 +690,10 @@ protected boolean tryRedisLockInner(long time, long expireAfter)
689
690
690
691
@ Override
691
692
protected boolean removeLockKeyInnerUnlink () {
693
+ final String unLockChannelKey = RedisLockRegistry .this .unLockChannelKey + ":" + this .lockKey ;
692
694
return Boolean .TRUE .equals (RedisLockRegistry .this .redisTemplate .execute (
693
- UNLINK_UNLOCK_REDIS_SCRIPT , Collections . singletonList (this .lockKey ),
694
- RedisLockRegistry .this .clientId , RedisLockRegistry . this . unLockChannelKey + ":" + this . lockKey ));
695
+ UNLINK_UNLOCK_REDIS_SCRIPT , List . of (this .lockKey , unLockChannelKey ),
696
+ RedisLockRegistry .this .clientId ));
695
697
}
696
698
697
699
private boolean subscribeLock (long time , long expireAfter ) throws ExecutionException , InterruptedException {
0 commit comments