修复@Lock注解解锁报错

This commit is contained in:
zlt2000
2020-09-07 12:56:11 +08:00
parent 1a5377898f
commit fdcbe775ea
2 changed files with 4 additions and 2 deletions
@@ -65,6 +65,8 @@ public interface DistributedLock {
* @param zLock 锁抽象对象
*/
default void unlock(ZLock zLock) throws Exception {
this.unlock(zLock.getLock());
if (zLock != null) {
this.unlock(zLock.getLock());
}
}
}
@@ -40,7 +40,6 @@ public class LockAspect {
@Around("@within(lock) || @annotation(lock)")
public Object aroundLock(ProceedingJoinPoint point, Lock lock) throws Throwable {
Object lockObj = null;
if (lock == null) {
// 获取类上的注解
lock = point.getTarget().getClass().getDeclaredAnnotation(Lock.class);
@@ -59,6 +58,7 @@ public class LockAspect {
Object[] args = point.getArgs();
lockKey = getValBySpEL(lockKey, methodSignature, args);
}
ZLock lockObj = null;
try {
//加锁
if (lock.waitTime() > 0) {