Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

很优秀的开源分布式锁,请问还维护吗 #33

Open
einsitang opened this issue Apr 25, 2021 · 7 comments
Open

很优秀的开源分布式锁,请问还维护吗 #33

einsitang opened this issue Apr 25, 2021 · 7 comments

Comments

@einsitang
Copy link

hello 作者,
我们项目需要用到分布式锁,觉得你这个项目非常棒,但很多依赖库都非常旧了,我们是基于Spring-boot 2.1.8 开发的应用,各种不兼容,需要拉去代码升级里面的spring库重新编译才可以使用。请问现在还维护吗,我给你提一个PR然后重新发布一个高版本的包

@klboke
Copy link
Contributor

klboke commented Apr 26, 2021

可以提个 pr 过来,我们看看兼容性

@einsitang
Copy link
Author

不好意思,最近项目比较急,迟点修正一下然后提PR给你们

@z5614036
Copy link

等你的pr了,老哥

@tangshd
Copy link

tangshd commented Jul 19, 2021 via email

@einsitang
Copy link
Author

不好意思,忙着项目给忘了

@chriswuchn
Copy link

你好,作者。看了你们的项目源码,非常棒,有一个小疑问,想请教一下。
`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)语句还是执行,会不会有问题?是不是应该直接返回?

@klboke
Copy link
Contributor

klboke commented Oct 24, 2022

@chriswuchn 不是很清楚你的问题,你贴的代码可以在格式化下么

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants