All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.quincy.core.aspect.DurationLogAop Maven / Gradle / Ivy

The newest version!
package com.quincy.core.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import com.quincy.sdk.helper.CommonHelper;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Aspect
@Order(10)
@Component
public class DurationLogAop {
	@Pointcut("@annotation(com.quincy.sdk.annotation.DurationLog)")
    public void pointCut() {}

	@Around("pointCut()")
    public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
		String fullMethodPath = CommonHelper.fullMethodPath(joinPoint, ".", "_", "#");
		long start = System.currentTimeMillis();
		Object toReturn = joinPoint.proceed();
		log.warn("DURATION=========================={}: {}", fullMethodPath, (System.currentTimeMillis()-start));
		return toReturn;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy