Example usage for org.springframework.util StopWatch getLastTaskInfo

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

Introduction

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

Prototype

public TaskInfo getLastTaskInfo() throws IllegalStateException 

Source Link

Document

Get the last task as a TaskInfo object.

Usage

From source file:example.springdata.redis.sentinel.RedisSentinelApplication.java

private static void printBackFromErrorStateInfoIfStopWatchIsRunning(StopWatch stopWatch) {

    if (stopWatch.isRunning()) {
        stopWatch.stop();// w w w.  j a  v a  2  s.co  m
        System.err.println("INFO: Recovered after: " + stopWatch.getLastTaskInfo().getTimeSeconds());
    }
}

From source file:net.sf.gazpachoquest.aspects.ProfilingAdvise.java

public Object doProfiling(final ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
    String taskName = createTaskName(proceedingJoinPoint);
    StopWatch taskTimer = new StopWatch();
    try {//w  w w . j a v  a2 s  .  co m
        taskTimer.start(taskName);
        return proceedingJoinPoint.proceed();
    } finally {
        taskTimer.stop();
        doLogging(taskTimer.getLastTaskInfo());
    }
}