修复@Lock注解解锁报错
This commit is contained in:
+3
-1
@@ -65,6 +65,8 @@ public interface DistributedLock {
|
|||||||
* @param zLock 锁抽象对象
|
* @param zLock 锁抽象对象
|
||||||
*/
|
*/
|
||||||
default void unlock(ZLock zLock) throws Exception {
|
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)")
|
@Around("@within(lock) || @annotation(lock)")
|
||||||
public Object aroundLock(ProceedingJoinPoint point, Lock lock) throws Throwable {
|
public Object aroundLock(ProceedingJoinPoint point, Lock lock) throws Throwable {
|
||||||
Object lockObj = null;
|
|
||||||
if (lock == null) {
|
if (lock == null) {
|
||||||
// 获取类上的注解
|
// 获取类上的注解
|
||||||
lock = point.getTarget().getClass().getDeclaredAnnotation(Lock.class);
|
lock = point.getTarget().getClass().getDeclaredAnnotation(Lock.class);
|
||||||
@@ -59,6 +58,7 @@ public class LockAspect {
|
|||||||
Object[] args = point.getArgs();
|
Object[] args = point.getArgs();
|
||||||
lockKey = getValBySpEL(lockKey, methodSignature, args);
|
lockKey = getValBySpEL(lockKey, methodSignature, args);
|
||||||
}
|
}
|
||||||
|
ZLock lockObj = null;
|
||||||
try {
|
try {
|
||||||
//加锁
|
//加锁
|
||||||
if (lock.waitTime() > 0) {
|
if (lock.waitTime() > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user