org.rx.spring.BaseInterceptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rxlib Show documentation
Show all versions of rxlib Show documentation
A set of utilities for Java
package org.rx.spring;
import io.netty.util.concurrent.FastThreadLocal;
import org.apache.commons.lang3.BooleanUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.reflect.MethodSignature;
import org.rx.core.Reflects;
import org.rx.core.Sys;
import static org.rx.core.Extends.as;
import static org.rx.core.Sys.*;
public abstract class BaseInterceptor {
static final FastThreadLocal idempotent = new FastThreadLocal<>();
protected CallLogBuilder logBuilder = Sys.DEFAULT_LOG_BUILDER;
public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
if (BooleanUtils.isTrue(idempotent.get())) {
return joinPoint.proceed();
}
idempotent.set(Boolean.TRUE);
try {
Signature signature = joinPoint.getSignature();
MethodSignature methodSignature = as(signature, MethodSignature.class);
Object[] args = joinPoint.getArgs();
return Sys.callLog(signature.getDeclaringType(), signature.getName(), args, new ProceedFunc