当前位置:网站首页>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(); }
边栏推荐
- CSRF, XSS science popularization and defense
- mapper. Comments in XML files
- Xiao Sha's arithmetic problem solving Report
- Fundamentals of data communication - Principles of IP routing
- 16.[STM32]从原理开始带你了解DS18B20温度传感器-四位数码管显示温度
- Virtual base class (a little difficult)
- Object. defineProperty() - VS - new Proxy()
- 数学建模之层次分析法(含MATLAB代码)
- SQL Server learning notes
- 18.[STM32]读取DS18B20温度传感器的ROM并实现多点测量温度
猜你喜欢
MySQL giant pit: update updates should be judged with caution by affecting the number of rows!!!
Good article inventory
Object. defineProperty() - VS - new Proxy()
19.[STM32]HC_SR04超声波测距_定时器方式(OLED显示)
Arduino controls a tiny hexapod 3D printing robot
Bugku telnet
五种常见的咨询公司谈判策略以及如何维护自己的利益
Bugku's eyes are not real
Analytic hierarchy process of mathematical modeling (including Matlab code)
RepLKNet:不是大卷积不好,而是卷积不够大,31x31卷积了解一下 | CVPR 2022
随机推荐
vant tabbar遮挡内容的解决方式
OSI seven layer model
MySQL overview
CSDN I'm coming
vulnhub-Root_ this_ box
Aike AI frontier promotion (7.5)
Linear DP (basic questions have been updated)
The difference between SQL Server char nchar varchar and nvarchar
Hongmeng system -- Analysis from the perspective of business
Record the pits encountered in the raspberry pie construction environment...
list集合根据对象某属性求和,最大值等
Bugku alert
How can the boss choose programmers to help me with development?
异常com.alibaba.fastjson.JSONException: not match : - =
Data communication foundation smart_ Link_&_ Monitor_ Link
String modification problem solving Report
The computer is busy, and the update is a little slow
项目sql中批量update的时候参数类型设置错误
Noi / 1.5 06: element maximum span value of integer sequence
六种常用事务解决方案,你方唱罢,我登场(没有最好只有更好)