Comments (7)
可以提个 pr 过来,我们看看兼容性
from spring-boot-klock-starter.
不好意思,最近项目比较急,迟点修正一下然后提PR给你们
from spring-boot-klock-starter.
等你的pr了,老哥
from spring-boot-klock-starter.
from spring-boot-klock-starter.
不好意思,忙着项目给忘了
from spring-boot-klock-starter.
你好,作者。看了你们的项目源码,非常棒,有一个小疑问,想请教一下。
`public Object around(ProceedingJoinPoint joinPoint, Klock klock) throws Throwable {
LockInfo lockInfo = this.lockInfoProvider.get(joinPoint, klock);
String curentLock = this.getCurrentLockId(joinPoint, klock);
this.currentThreadLock.put(curentLock, new KlockAspectHandler.LockRes(lockInfo, false));
Lock lock = this.lockFactory.getLock(lockInfo);
boolean lockRes = lock.acquire();
if (!lockRes) {
if (logger.isWarnEnabled()) {
logger.warn("Timeout while acquiring Lock({})", lockInfo.getName());
}
if (!StringUtils.isEmpty(klock.customLockTimeoutStrategy())) {
return this.handleCustomLockTimeout(klock.customLockTimeoutStrategy(), joinPoint);
}
//执行失败默认策略
klock.lockTimeoutStrategy().handle(lockInfo, lock, joinPoint);
}
((KlockAspectHandler.LockRes)this.currentThreadLock.get(curentLock)).setLock(lock); //(1)
((KlockAspectHandler.LockRes)this.currentThreadLock.get(curentLock)).setRes(true); //(2)
return joinPoint.proceed(); //(3)
}`
当获取锁失败时候,执行默认策略,默认策略如下:
NO_OPERATION { public void handle(LockInfo lockInfo, Lock lock, JoinPoint joinPoint) { } }
如果是这种情况的话,(1),(2),(3)语句还是执行,会不会有问题?是不是应该直接返回?
from spring-boot-klock-starter.
@chriswuchn 不是很清楚你的问题,你贴的代码可以在格式化下么
from spring-boot-klock-starter.
Related Issues (20)
- 自定义处理方法 HOT 10
- 问下为什么解锁使用了异步强制解锁?有什么必要使用它嘛?使用异步强制解锁有什么优点嘛?相比于正常的同步解锁 HOT 1
- 报错了。。 HOT 1
- 命名不太符合spring boot规范 HOT 1
- 希望能使用spring.redis.xxx的配置 HOT 1
- Spring MVC项目怎么引用呢 HOT 1
- redis连接池不用配置吗 HOT 2
- 指定lock的name属性,redis设置的key并不止name,还是会加上其他的字符 HOT 1
- 关于keys,有几个问题想请教下 HOT 3
- 同一线程中嵌套调用引发的问题 HOT 2
- @KlockKey 方法参数为null时报空指针 HOT 3
- 同一线程同一把锁重入时的问题 HOT 4
- 是否支持非注解模式
- 是否支持非spring管理类的使用
- 报错:求助
- 读写锁没有意义
- 最大连接数可以限制吗?
- 2022年了请问还维护吗 HOT 2
- 如果不配置klock的 redis配置,是否使用默认的redis
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-boot-klock-starter.