Giter Site home page Giter Site logo

Comments (7)

klboke avatar klboke commented on May 24, 2024

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

from spring-boot-klock-starter.

einsitang avatar einsitang commented on May 24, 2024

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

from spring-boot-klock-starter.

z5614036 avatar z5614036 commented on May 24, 2024

等你的pr了,老哥

from spring-boot-klock-starter.

tangshd avatar tangshd commented on May 24, 2024

from spring-boot-klock-starter.

einsitang avatar einsitang commented on May 24, 2024

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

from spring-boot-klock-starter.

chriswuchn avatar chriswuchn commented on May 24, 2024

你好,作者。看了你们的项目源码,非常棒,有一个小疑问,想请教一下。
`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.

klboke avatar klboke commented on May 24, 2024

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

from spring-boot-klock-starter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.