额外邀请 统计发放次数

This commit is contained in:
2025-03-20 14:50:46 +08:00
parent 1e3e9ad7c0
commit 8e52e68efe
4 changed files with 67 additions and 54 deletions

View File

@@ -32,7 +32,7 @@ public class DebounceAspect {
// 用于存储基于方法和入参情况的上次执行时间,结构为:方法签名 -> (入参值 -> 上次执行时间)
private static final ConcurrentHashMap<String, ConcurrentHashMap<Object, Long>> executionTimeMap = new ConcurrentHashMap<>();
private static final ReentrantLock lock = new ReentrantLock();
private static final ReentrantLock LOCK = new ReentrantLock();
@Around("logPointCut()")
public Object aroundDebounce(ProceedingJoinPoint joinPoint) throws Throwable {
@@ -95,7 +95,7 @@ public class DebounceAspect {
public void cleanExpiredRecords() {
long expirationTime = System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(10);
lock.lock();
LOCK.lock();
try {
for (Entry<String, ConcurrentHashMap<Object, Long>> outerEntry : executionTimeMap.entrySet()) {
String methodSignature = outerEntry.getKey();
@@ -112,7 +112,7 @@ public class DebounceAspect {
}
}
} finally {
lock.unlock();
LOCK.unlock();
}
}
}

View File

@@ -10,6 +10,9 @@ import org.springframework.expression.spel.support.StandardEvaluationContext;
import java.lang.reflect.Method;
/**
* @author ww
*/
public class SpelUtil {
/**
* 用于SpEL表达式解析.