本文整理了Java中org.springframework.util.StopWatch.currentTaskName()
方法的一些代码示例,展示了StopWatch.currentTaskName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StopWatch.currentTaskName()
方法的具体详情如下:
包路径:org.springframework.util.StopWatch
类名称:StopWatch
方法名:currentTaskName
[英]Name of the current task
[中]当前任务的名称
代码示例来源:origin: spring-projects/spring-framework
Thread.sleep(int1);
assertTrue(sw.isRunning());
assertEquals(name1, sw.currentTaskName());
sw.stop();
代码示例来源:origin: dsyer/spring-boot-aspectj
@Around("execution(* org.springframework.boot.SpringApplication+.*(..))")
public Object initializer(ProceedingJoinPoint joinPoint) throws Throwable {
String task = app.currentTaskName();
if (task != null) {
app.stop();
}
long t0 = System.currentTimeMillis();
level++;
app.start(joinPoint.getSignature().getName());
Object result = joinPoint.proceed();
long t1 = System.currentTimeMillis();
app.stop();
if (task != null) {
app.start(task);
}
logger.info("App," + level + "," + joinPoint.getSignature().getName() + ","
+ (t1 - t0));
level--;
return result;
}
代码示例来源:origin: dsyer/spring-boot-aspectj
@Around("execution(* org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory+.initializeBean(String, Object, ..)) && args(name,bean,..)")
public Object init(ProceedingJoinPoint joinPoint, String name, Object bean)
throws Throwable {
String task = init.currentTaskName();
if (task != null) {
init.stop();
}
init.start(name);
int count0 = init.getTaskCount();
long t0 = System.currentTimeMillis();
Object result = joinPoint.proceed();
long t1 = System.currentTimeMillis();
int count1 = init.getTaskCount();
init.stop();
if (task != null) {
init.start(task);
}
else {
logger.info("Init,," + bean.getClass().getName() + "," + (t1 - t0));
logger.info("Count,," + bean.getClass().getName() + "," + (count1 - count0));
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!