Redisson分布式锁和同步器详解-官方原版

本文涉及的产品
Redis 开源版,标准版 2GB
推荐场景:
搭建游戏排行榜
云数据库 Tair(兼容Redis),内存型 2GB
简介: Redisson分布式锁和同步器详解-官方原版

一、锁定

基于Redis的Java分布式可重入锁对象,并实现了锁接口。

如果获取锁的Redisson实例崩溃,则此类锁可能会在获取状态下永久挂起。为了避免这种Redisson维护锁watchdog,当锁持有者Redisson实例处于活动状态时,它会延长锁的到期时间。默认情况下,lock watchdog超时为30秒,可以通过Config.lockWatchdogTimeout设置进行更改。

可以定义锁获取期间的leaseTime参数。在指定的时间间隔后,锁定的锁将自动释放。

RLock对象的行为符合Java Lock规范。这意味着只有锁所有者线程才能解锁它,否则将引发IllegalMonitorStateException。否则,请考虑使用RSemaphore对象。

代码示例:

RLock lock = redisson.getLock("myLock");
// traditional lock method
lock.lock();
// or acquire lock and automatically unlock it after 10 seconds
lock.lock(10, TimeUnit.SECONDS);
// or wait for lock aquisition up to 100 seconds 
// and automatically unlock it after 10 seconds
boolean res = lock.tryLock(100, 10, TimeUnit.SECONDS);
if (res) {
   try {
     ...
   } finally {
       lock.unlock();
   }
}

异步接口用法的代码示例:

RLock lock = redisson.getLock("myLock");
RFuture<Void> lockFuture = lock.lockAsync();
// or acquire lock and automatically unlock it after 10 seconds
RFuture<Void> lockFuture = lock.lockAsync(10, TimeUnit.SECONDS);
// or wait for lock aquisition up to 100 seconds 
// and automatically unlock it after 10 seconds
RFuture<Boolean> lockFuture = lock.tryLockAsync(100, 10, TimeUnit.SECONDS);
lockFuture.whenComplete((res, exception) -> {
    // ...
    lock.unlockAsync();
});

反应式接口用法的代码示例:

RedissonReactiveClient redisson = redissonClient.reactive();
RLockReactive lock = redisson.getLock("myLock");
Mono<Void> lockMono = lock.lock();
// or acquire lock and automatically unlock it after 10 seconds
Mono<Void> lockMono = lock.lock(10, TimeUnit.SECONDS);
// or wait for lock aquisition up to 100 seconds 
// and automatically unlock it after 10 seconds
Mono<Boolean> lockMono = lock.tryLock(100, 10, TimeUnit.SECONDS);
lockMono.doOnNext(res -> {
   // ...
})
.doFinally(lock.unlock())
.subscribe();

RxJava3 接口使用的代码示例:

RedissonRxClient redisson = redissonClient.rxJava();
RLockRx lock = redisson.getLock("myLock");
Completable lockRes = lock.lock();
// or acquire lock and automatically unlock it after 10 seconds
Completable lockRes = lock.lock(10, TimeUnit.SECONDS);
// or wait for lock aquisition up to 100 seconds 
// and automatically unlock it after 10 seconds
Single<Boolean> lockRes = lock.tryLock(100, 10, TimeUnit.SECONDS);
lockRes.doOnSuccess(res -> {
   // ...
})
.doFinally(lock.unlock())
.subscribe();

二、公平锁定

基于Redis的分布式可重入公平Java锁对象实现了锁接口。

公平锁保证线程将按照请求的顺序获取它。所有等待的线程都将排队,如果某个线程已死亡,Redisson将等待其返回5秒。例如,如果5个线程由于某种原因而死亡,那么延迟将为25秒。

如果获取锁的Redisson实例崩溃,则此类锁可能会在获取状态下永久挂起。为了避免这种Redisson维护锁看门狗,当锁持有者Redisson实例处于活动状态时,它会延长锁的到期时间。默认情况下,锁看门狗超时为30秒,可以通过Config.lockWatchdogTimeout设置进行更改。

可以定义锁获取期间的leaseTime参数。在指定的时间间隔后,锁定的锁将自动释放。

RLock对象的行为符合Java Lock规范。这意味着只有锁所有者线程才能解锁它,否则将引发IllegalMonitorStateException。否则,请考虑使用RSemaphore对象。

代码示例:

RLock lock = redisson.getFairLock("myLock");
// traditional lock method
lock.lock();
// or acquire lock and automatically unlock it after 10 seconds
lock.lock(10, TimeUnit.SECONDS);
// or wait for lock aquisition up to 100 seconds 
// and automatically unlock it after 10 seconds
boolean res = lock.tryLock(100, 10, TimeUnit.SECONDS);
if (res) {
   try {
     ...
   } finally {
       lock.unlock();
   }
}

异步接口用法的代码示例:

RLock lock = redisson.getFairLock("myLock");
RFuture<Void> lockFuture = lock.lockAsync();
// or acquire lock and automatically unlock it after 10 seconds
RFuture<Void> lockFuture = lock.lockAsync(10, TimeUnit.SECONDS);
// or wait for lock aquisition up to 100 seconds 
// and automatically unlock it after 10 seconds
RFuture<Boolean> lockFuture = lock.tryLockAsync(100, 10, TimeUnit.SECONDS);
lockFuture.whenComplete((res, exception) -> {
    // ...
    lock.unlockAsync();
});

Reactive接口 用法的代码示例:

RedissonReactiveClient redisson = redissonClient.reactive();
RLockReactive lock = redisson.getFairLock("myLock");
Mono<Void> lockMono = lock.lock();
// or acquire lock and automatically unlock it after 10 seconds
Mono<Void> lockMono = lock.lock(10, TimeUnit.SECONDS);
// or wait for lock aquisition up to 100 seconds 
// and automatically unlock it after 10 seconds
Mono<Boolean> lockMono = lock.tryLock(100, 10, TimeUnit.SECONDS);
lockMono.doOnNext(res -> {
   // ...
})
.doFinally(lock.unlock())
.subscribe();

RxJava3 接口使用的代码示例:

RedissonRxClient redisson = redissonClient.rxJava();
RLockRx lock = redisson.getFairLock("myLock");
Completable lockRes = lock.lock();
// or acquire lock and automatically unlock it after 10 seconds
Completable lockRes = lock.lock(10, TimeUnit.SECONDS);
// or wait for lock aquisition up to 100 seconds 
// and automatically unlock it after 10 seconds
Single<Boolean> lockRes = lock.tryLock(100, 10, TimeUnit.SECONDS);
lockRes.doOnSuccess(res -> {
   // ...
})
.doFinally(lock.unlock())
.subscribe();

三、多重锁

基于Redis的分布式MultiLock对象允许将Lock对象分组,并将其作为单个锁处理。每个RLock对象可能属于不同的Redisson实例。

如果获取MultiLock的Redisson实例崩溃,那么这样的MultiLock可能会永远挂在获取状态。为了避免这种Redisson维护锁watchdog,当锁持有者Redisson实例处于活动状态时,它会延长锁的到期时间。默认情况下,lock watchdog超时为30秒,可以通过Config.lockWatchdogTimeout设置进行更改。

可以定义锁获取期间的leaseTime参数。在指定的时间间隔后,锁定的锁将自动释放。

MultiLock对象的行为符合Java Lock规范。这意味着只有锁所有者线程才能解锁它,否则将引发IllegalMonitorStateException。否则,请考虑使用RSemaphore对象。

代码示例:

RLock lock1 = redisson1.getLock("lock1");
RLock lock2 = redisson2.getLock("lock2");
RLock lock3 = redisson3.getLock("lock3");
RLock multiLock = anyRedisson.getMultiLock(lock1, lock2, lock3);
// traditional lock method
multiLock.lock();
// or acquire lock and automatically unlock it after 10 seconds
multiLock.lock(10, TimeUnit.SECONDS);
// or wait for lock aquisition up to 100 seconds 
// and automatically unlock it after 10 seconds
boolean res = multiLock.tryLock(100, 10, TimeUnit.SECONDS);
if (res) {
   try {
     ...
   } finally {
       multiLock.unlock();
   }
}

异步接口用法的代码示例:

RLock lock1 = redisson1.getLock("lock1");
RLock lock2 = redisson2.getLock("lock2");
RLock lock3 = redisson3.getLock("lock3");
RLock multiLock = anyRedisson.getMultiLock(lock1, lock2, lock3);
RFuture<Void> lockFuture = multiLock.lockAsync();
// or acquire lock and automatically unlock it after 10 seconds
RFuture<Void> lockFuture = multiLock.lockAsync(10, TimeUnit.SECONDS);
// or wait for lock aquisition up to 100 seconds 
// and automatically unlock it after 10 seconds
RFuture<Boolean> lockFuture = multiLock.tryLockAsync(100, 10, TimeUnit.SECONDS);
lockFuture.whenComplete((res, exception) -> {
    // ...
    multiLock.unlockAsync();
});

反应式接口用法的代码示例:

RedissonReactiveClient anyRedisson = redissonClient.reactive();
RLockReactive lock1 = redisson1.getLock("lock1");
RLockReactive lock2 = redisson2.getLock("lock2");
RLockReactive lock3 = redisson3.getLock("lock3");
RLockReactive multiLock = anyRedisson.getMultiLock(lock1, lock2, lock3);
Mono<Void> lockMono = multiLock.lock();
// or acquire lock and automatically unlock it after 10 seconds
Mono<Void> lockMono = multiLock.lock(10, TimeUnit.SECONDS);
// or wait for lock aquisition up to 100 seconds 
// and automatically unlock it after 10 seconds
Mono<Boolean> lockMono = multiLock.tryLock(100, 10, TimeUnit.SECONDS);
lockMono.doOnNext(res -> {
   // ...
})
.doFinally(multiLock.unlock())
.subscribe();

RxJava3 接口使用的代码示例:

RedissonRxClient anyRedisson = redissonClient.rxJava();
RLockRx lock1 = redisson1.getLock("lock1");
RLockRx lock2 = redisson2.getLock("lock2");
RLockRx lock3 = redisson3.getLock("lock3");
RLockRx multiLock = anyRedisson.getMultiLock(lock1, lock2, lock3);
Completable lockRes = multiLock.lock();
// or acquire lock and automatically unlock it after 10 seconds
Completable lockRes = multiLock.lock(10, TimeUnit.SECONDS);
// or wait for lock aquisition up to 100 seconds 
// and automatically unlock it after 10 seconds
Single<Boolean> lockRes = multiLock.tryLock(100, 10, TimeUnit.SECONDS);
lockRes.doOnSuccess(res -> {
   // ...
})
.doFinally(multiLock.unlock())
.subscribe();

四、读写锁定

基于Redis的Java分布式可重入读写锁对象实现了读写锁接口。读和写锁都实现RLock接口。

只允许有多个ReadLock所有者和一个WriteLock所有者。

如果获取锁的Redisson实例崩溃,则此类锁可能会在获取状态下永久挂起。为了避免这种Redisson维护锁看门狗,当锁持有者Redisson实例处于活动状态时,它会延长锁的到期时间。默认情况下,锁看门狗超时为30秒,可以通过Config.lockWatchdogTimeout设置进行更改。

此外,Redisson允许在获取锁期间指定leaseTime参数。在指定的时间间隔后,锁定的锁将自动释放。

RLock对象的行为符合Java Lock规范。这意味着只有锁所有者线程才能解锁它,否则将引发IllegalMonitorStateException。否则,请考虑使用RSemaphore对象。

代码示例:

RReadWriteLock rwlock = redisson.getReadWriteLock("myLock");
RLock lock = rwlock.readLock();
// or
RLock lock = rwlock.writeLock();
// traditional lock method
lock.lock();
// or acquire lock and automatically unlock it after 10 seconds
lock.lock(10, TimeUnit.SECONDS);
// or wait for lock aquisition up to 100 seconds 
// and automatically unlock it after 10 seconds
boolean res = lock.tryLock(100, 10, TimeUnit.SECONDS);
if (res) {
   try {
     ...
   } finally {
       lock.unlock();
   }
}

异步接口用法的代码示例:

RReadWriteLock rwlock = redisson.getReadWriteLock("myLock");
RLock lock = rwlock.readLock();
// or
RLock lock = rwlock.writeLock();
RFuture<Void> lockFuture = lock.lockAsync();
// or acquire lock and automatically unlock it after 10 seconds
RFuture<Void> lockFuture = lock.lockAsync(10, TimeUnit.SECONDS);
// or wait for lock aquisition up to 100 seconds 
// and automatically unlock it after 10 seconds
RFuture<Boolean> lockFuture = lock.tryLockAsync(100, 10, TimeUnit.SECONDS);
lockFuture.whenComplete((res, exception) -> {
    // ...
    lock.unlockAsync();
});

反应式接口用法的代码示例:

RedissonReactiveClient redisson = redissonClient.reactive();
RReadWriteLockReactive rwlock = redisson.getReadWriteLock("myLock");
RLockReactive lock = rwlock.readLock();
// or
RLockReactive lock = rwlock.writeLock();
Mono<Void> lockMono = lock.lock();
// or acquire lock and automatically unlock it after 10 seconds
Mono<Void> lockMono = lock.lock(10, TimeUnit.SECONDS);
// or wait for lock aquisition up to 100 seconds 
// and automatically unlock it after 10 seconds
Mono<Boolean> lockMono = lock.tryLock(100, 10, TimeUnit.SECONDS);
lockMono.doOnNext(res -> {
   // ...
})
.doFinally(lock.unlock())
.subscribe();

RxJava3 接口使用的代码示例:

RedissonRxClient redisson = redissonClient.rxJava();
RReadWriteLockRx rwlock = redisson.getReadWriteLock("myLock");
RLockRx lock = rwlock.readLock();
// or
RLockRx lock = rwlock.writeLock();
Completable lockRes = lock.lock();
// or acquire lock and automatically unlock it after 10 seconds
Completable lockRes = lock.lock(10, TimeUnit.SECONDS);
// or wait for lock aquisition up to 100 seconds 
// and automatically unlock it after 10 seconds
Single<Boolean> lockRes = lock.tryLock(100, 10, TimeUnit.SECONDS);
lockRes.doOnSuccess(res -> {
   // ...
})
.doFinally(lock.unlock())
.subscribe();

五、信号量

基于Redis的分布式Java信号量对象,类似于信号量对象。

可以在使用前初始化,但这不是必需的,通过trySetPermissions(permissions)方法获得可用的许可量。

代码示例:

RSemaphore semaphore = redisson.getSemaphore("mySemaphore");
// acquire single permit
semaphore.acquire();
// or acquire 10 permits
semaphore.acquire(10);
// or try to acquire permit
boolean res = semaphore.tryAcquire();
// or try to acquire permit or wait up to 15 seconds
boolean res = semaphore.tryAcquire(15, TimeUnit.SECONDS);
// or try to acquire 10 permit
boolean res = semaphore.tryAcquire(10);
// or try to acquire 10 permits or wait up to 15 seconds
boolean res = semaphore.tryAcquire(10, 15, TimeUnit.SECONDS);
if (res) {
   try {
     ...
   } finally {
       semaphore.release();
   }
}

异步接口用法的代码示例:

RSemaphore semaphore = redisson.getSemaphore("mySemaphore");
// acquire single permit
RFuture<Void> acquireFuture = semaphore.acquireAsync();
// or acquire 10 permits
RFuture<Void> acquireFuture = semaphore.acquireAsync(10);
// or try to acquire permit
RFuture<Boolean> acquireFuture = semaphore.tryAcquireAsync();
// or try to acquire permit or wait up to 15 seconds
RFuture<Boolean> acquireFuture = semaphore.tryAcquireAsync(15, TimeUnit.SECONDS);
// or try to acquire 10 permit
RFuture<Boolean> acquireFuture = semaphore.tryAcquireAsync(10);
// or try to acquire 10 permits or wait up to 15 seconds
RFuture<Boolean> acquireFuture = semaphore.tryAcquireAsync(10, 15, TimeUnit.SECONDS);
acquireFuture.whenComplete((res, exception) -> {
    // ...
    semaphore.releaseAsync();
});

反应式接口用法的代码示例:

RedissonReactiveClient redisson = redissonClient.reactive();
RSemaphoreReactive semaphore = redisson.getSemaphore("mySemaphore");
// acquire single permit
Mono<Void> acquireMono = semaphore.acquire();
// or acquire 10 permits
Mono<Void> acquireMono = semaphore.acquire(10);
// or try to acquire permit
Mono<Boolean> acquireMono = semaphore.tryAcquire();
// or try to acquire permit or wait up to 15 seconds
Mono<Boolean> acquireMono = semaphore.tryAcquire(15, TimeUnit.SECONDS);
// or try to acquire 10 permit
Mono<Boolean> acquireMono = semaphore.tryAcquire(10);
// or try to acquire 10 permits or wait up to 15 seconds
Mono<Boolean> acquireMono = semaphore.tryAcquire(10, 15, TimeUnit.SECONDS);
acquireMono.doOnNext(res -> {
   // ...
})
.doFinally(semaphore.release())
.subscribe();

RxJava3 接口使用的代码示例:

RedissonRxClient redisson = redissonClient.rxJava();
RSemaphoreRx semaphore = redisson.getSemaphore("mySemaphore");
// acquire single permit
Completable acquireRx = semaphore.acquire();
// or acquire 10 permits
Completable acquireRx = semaphore.acquire(10);
// or try to acquire permit
Single<Boolean> acquireRx = semaphore.tryAcquire();
// or try to acquire permit or wait up to 15 seconds
Single<Boolean> acquireRx = semaphore.tryAcquire(15, TimeUnit.SECONDS);
// or try to acquire 10 permit
Single<Boolean> acquireRx = semaphore.tryAcquire(10);
// or try to acquire 10 permits or wait up to 15 seconds
Single<Boolean> acquireRx = semaphore.tryAcquire(10, 15, TimeUnit.SECONDS);
acquireRx.doOnSuccess(res -> {
   // ...
})
.doFinally(semaphore.release())
.subscribe();

六、允许可过期信号量

基于 Redis 的分布式 Java 信号量对象,每个获取的许可证都支持租用时间参数。每个许可证都由自己的身份证标识,只能使用其身份证签发。

应在使用前通过trySetPermissions(permissions)方法使用可用许可量进行初始化。允许通过addPermissions(许可证)方法增加/减少可用许可证的数量。

代码示例:

RPermitExpirableSemaphore semaphore = redisson.getPermitExpirableSemaphore("mySemaphore");
semaphore.trySetPermits(23);
// acquire permit
String id = semaphore.acquire();
// or acquire permit with lease time in 10 seconds
String id = semaphore.acquire(10, TimeUnit.SECONDS);
// or try to acquire permit
String id = semaphore.tryAcquire();
// or try to acquire permit or wait up to 15 seconds
String id = semaphore.tryAcquire(15, TimeUnit.SECONDS);
// or try to acquire permit with least time 15 seconds or wait up to 10 seconds
String id = semaphore.tryAcquire(10, 15, TimeUnit.SECONDS);
if (id != null) {
   try {
     ...
   } finally {
       semaphore.release(id);
   }
}

异步接口用法的代码示例:

RPermitExpirableSemaphore semaphore = redisson.getPermitExpirableSemaphore("mySemaphore");
RFuture<Boolean> setFuture = semaphore.trySetPermitsAsync(23);
// acquire permit
RFuture<String> acquireFuture = semaphore.acquireAsync();
// or acquire permit with lease time in 10 seconds
RFuture<String> acquireFuture = semaphore.acquireAsync(10, TimeUnit.SECONDS);
// or try to acquire permit
RFuture<String> acquireFuture = semaphore.tryAcquireAsync();
// or try to acquire permit or wait up to 15 seconds
RFuture<String> acquireFuture = semaphore.tryAcquireAsync(15, TimeUnit.SECONDS);
// or try to acquire permit with least time 15 seconds or wait up to 10 seconds
RFuture<String> acquireFuture = semaphore.tryAcquireAsync(10, 15, TimeUnit.SECONDS);
acquireFuture.whenComplete((id, exception) -> {
    // ...
    semaphore.releaseAsync(id);
});

反应式接口用法的代码示例:

RedissonReactiveClient redisson = redissonClient.reactive();
RPermitExpirableSemaphoreReactive semaphore = redisson.getPermitExpirableSemaphore("mySemaphore");
Mono<Boolean> setMono = semaphore.trySetPermits(23);
// acquire permit
Mono<String> acquireMono = semaphore.acquire();
// or acquire permit with lease time in 10 seconds
Mono<String> acquireMono = semaphore.acquire(10, TimeUnit.SECONDS);
// or try to acquire permit
Mono<String> acquireMono = semaphore.tryAcquire();
// or try to acquire permit or wait up to 15 seconds
Mono<String> acquireMono = semaphore.tryAcquire(15, TimeUnit.SECONDS);
// or try to acquire permit with least time 15 seconds or wait up to 10 seconds
Mono<String> acquireMono = semaphore.tryAcquire(10, 15, TimeUnit.SECONDS);
acquireMono.flatMap(id -> {
   // ...
   return semaphore.release(id);
}).subscribe();

RxJava3 接口使用的代码示例

RedissonRxClient redisson = redissonClient.rxJava();
RPermitExpirableSemaphoreRx semaphore = redisson.getPermitExpirableSemaphore("mySemaphore");
Single<Boolean> setRx = semaphore.trySetPermits(23);
// acquire permit
Single<String> acquireRx = semaphore.acquire();
// or acquire permit with lease time in 10 seconds
Single<String> acquireRx = semaphore.acquire(10, TimeUnit.SECONDS);
// or try to acquire permit
Maybe<String> acquireRx = semaphore.tryAcquire();
// or try to acquire permit or wait up to 15 seconds
Maybe<String> acquireRx = semaphore.tryAcquire(15, TimeUnit.SECONDS);
// or try to acquire permit with least time 15 seconds or wait up to 10 seconds
Maybe<String> acquireRx = semaphore.tryAcquire(10, 15, TimeUnit.SECONDS);
acquireRx.flatMap(id -> {
   // ...
   return semaphore.release(id);
}).subscribe();




文章下方有交流学习区!一起学习进步!也可以前往官网,加入官方微信交流群!!!你的支持和鼓励是我创作的动力❗❗❗

Doker的成长,欢迎大家一起陪伴!!!

官网:Doker 多克; 官方旗舰店首页-Doker 多克 3C旗舰店-淘宝网 全品优惠

相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore &nbsp; &nbsp; ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库&nbsp;ECS 实例和一台目标数据库&nbsp;RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&amp;RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
目录
相关文章
|
6月前
|
NoSQL Java Redis
分布式锁框架Lock4j简单使用
最近项目中使用到了Lock4j的分布式锁组件,小编今天就带大家学习一下该框架,以及如何在我们项目中进行集成使用。
|
运维 NoSQL 安全
Redisson分布式锁最基础内容
Redisson分布式锁最基础内容
85 0
|
6月前
|
NoSQL Java API
Redisson源码(一)RedissonLock加锁与解锁过程原理分析
RedissonLock加锁与解锁过程原理分析
1423 4
Redisson源码(一)RedissonLock加锁与解锁过程原理分析
|
6月前
|
NoSQL Java 中间件
如何使用Redisson实现分布式锁?
如何使用Redisson实现分布式锁?
349 1
|
缓存 NoSQL API
分布式锁工具:Redisson,很强!
分布式锁工具:Redisson,很强!
297 1
|
NoSQL Java Redis
Redisson分布式锁和同步器详解-官方原版
Redisson分布式锁和同步器详解-官方原版
151 0
|
NoSQL 算法 Java
【Redis基础指南】分析一下Redission实现分布式锁的点点滴滴(含加解锁源码)
【Redis基础指南】分析一下Redission实现分布式锁的点点滴滴(含加解锁源码)
387 0
【Redis基础指南】分析一下Redission实现分布式锁的点点滴滴(含加解锁源码)
|
Java
Redisson 分布式锁源码 10:读写锁
Redisson 还支持可重入读写锁,允许在分布式场景下,同时有多个读锁和一个写锁处于加锁状态。
328 0
|
存储 NoSQL JavaScript
最强分布式锁工具:Redisson(一)
最强分布式锁工具:Redisson
最强分布式锁工具:Redisson(一)
|
监控 NoSQL 前端开发
最强分布式锁工具:Redisson(二)
最强分布式锁工具:Redisson(二)
最强分布式锁工具:Redisson(二)