当前位置:网站首页>RLock锁的使用
RLock锁的使用
2022-07-05 15:26:00 【小蚂蚁hjk】
try { RLock lock = redissonClient.getLock("ppt:pos:sms:code:lock:" + "orderSmsCode"); System.out.println("得到的锁"); //尝试获取锁 boolean success = lock.tryLock(30, 60, TimeUnit.SECONDS); if(success){ System.out.println("获取锁成功"); } // 如果当前线程还持有锁,则释放锁(防止超过一定时间,自动解锁) if(lock.isHeldByCurrentThread()) { lock.unlock(); } } catch (InterruptedException e) { e.printStackTrace(); }
边栏推荐
- Bugku cyberpunk
- lv_ font_ Conv offline conversion
- 16. [stm32] starting from the principle, I will show you the DS18B20 temperature sensor - four digit digital tube displays the temperature
- Fundamentals of data communication - Principles of IP routing
- Information collection of penetration test
- OceanBase社区版之OBD方式部署方式本地安装
- 复现Thinkphp 2.x 任意代码执行漏洞
- F. Weights assignment for tree edges problem solving Report
- F. Min cost string problem solving Report
- 我们为什么要学习数学建模?
猜你喜欢
Fundamentals of data communication - Principles of IP routing
Summary of the third class
Data communication foundation - Ethernet port mirroring and link aggregation
lv_font_conv离线转换
Data communication foundation - routing communication between VLANs
【簡記】解决IDE golang 代碼飄紅報錯
Bugku's Ah Da
Bugku easy_ nbt
JS knowledge points-01
Anti shake and throttling
随机推荐
Replknet: it's not that large convolution is bad, but that convolution is not large enough. 31x31 convolution. Let's have a look at | CVPR 2022
lv_ font_ Conv offline conversion
Database learning - Database Security
18.[STM32]读取DS18B20温度传感器的ROM并实现多点测量温度
F. Weights assignment for tree edges problem solving Report
Object. defineProperty() - VS - new Proxy()
Bugku's Eval
数学建模之层次分析法(含MATLAB代码)
I spring and autumn blasting-1
vant tabbar遮挡内容的解决方式
OceanBase社区版之OBD方式部署方式本地安装
Arduino控制微小的六足3D打印机器人
Bugku's steganography
obj解析为集合
Array sorting num ranking merge in ascending order
verilog实现计算最大公约数和最小公倍数
示例项目:简单的六足步行者
vant popup+其他组件的组合使用,及避坑指南
Codasip adds verify safe startup function to risc-v processor series
Bugku cyberpunk