新增zookeeper-starter实现zookeeper分布式锁

This commit is contained in:
zlt2000
2021-04-03 23:08:42 +08:00
parent 0ce8b4d6f5
commit 9f5b5d1c01
12 changed files with 223 additions and 6 deletions
@@ -32,9 +32,9 @@ public class RedissonDistributedLock implements DistributedLock {
private ZLock getLock(String key, boolean isFair) {
RLock lock;
if (isFair) {
lock = redisson.getFairLock(CommonConstant.LOCK_KEY_PREFIX + key);
lock = redisson.getFairLock(CommonConstant.LOCK_KEY_PREFIX + ":" + key);
} else {
lock = redisson.getLock(CommonConstant.LOCK_KEY_PREFIX + key);
lock = redisson.getLock(CommonConstant.LOCK_KEY_PREFIX + ":" + key);
}
return new ZLock(lock, this);
}