Example usage for org.springframework.util StopWatch getLastTaskName

List of usage examples for org.springframework.util StopWatch getLastTaskName

Introduction

In this page you can find the example usage for org.springframework.util StopWatch getLastTaskName.

Prototype

public String getLastTaskName() throws IllegalStateException 

Source Link

Document

Get the name of the last task.

Usage

From source file:org.axonframework.samples.trader.infra.util.ProfilingAspect.java

@Around("methodsToBeProfiled()")
public Object profile(ProceedingJoinPoint pjp) throws Throwable {
    StopWatch sw = new StopWatch(getClass().getSimpleName());
    try {//www.  j  a  v a 2s. c om
        sw.start(pjp.getSignature().getName());
        return pjp.proceed();
    } finally {
        sw.stop();
        System.out.println(sw.getLastTaskName() + sw.shortSummary());
    }
}

From source file:com.si.xe.trader.infra.util.ProfilingAspect.java

@Around("methodsToBeProfiled()")
public Object profile(ProceedingJoinPoint pjp) throws Throwable {
    StopWatch sw = new StopWatch(getClass().getSimpleName());
    try {/* w w w. j a  va2 s  .  c  o  m*/
        sw.start(pjp.getSignature().getName());
        return pjp.proceed();
    } finally {
        sw.stop();
        System.out.println(sw.getLastTaskName() + sw.shortSummary());
    }

}

From source file:org.springframework.aop.aspectj.autoproxy.AspectJAutoProxyCreatorTests.java

private static void assertStopWatchTimeLimit(final StopWatch sw, final long maxTimeMillis) {
    final long totalTimeMillis = sw.getTotalTimeMillis();
    assertTrue("'" + sw.getLastTaskName() + "' took too long: expected less than<" + maxTimeMillis
            + "> ms, actual<" + totalTimeMillis + "> ms.", totalTimeMillis < maxTimeMillis);
}