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

org.bidib.wizard.server.aspect.ExecutionTimeAspect Maven / Gradle / Ivy

There is a newer version: 2.0.29
Show newest version
package org.bidib.wizard.server.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Aspect
public class ExecutionTimeAspect {
    private static final Logger LOGGER = LoggerFactory.getLogger(ExecutionTimeAspect.class);

    @Around("@annotation(LogExecutionTime)")
    public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable {
        long start = System.currentTimeMillis();

        Object proceed = null;
        try {
            proceed = joinPoint.proceed();
        }
        finally {
            long executionTime = System.currentTimeMillis() - start;

            LOGGER.info(joinPoint.getSignature() + " executed in " + executionTime + "ms");
        }
        return proceed;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy