Commit 6dcdfdc0 authored by yanzg's avatar yanzg

修复等待时间

parent 11852664
......@@ -7,6 +7,8 @@ import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
......@@ -27,6 +29,10 @@ public class AspectLogTime implements ThreadNext.Next, InitializingBean {
@Override
public boolean next() {
List<AspectUrlCountVo> rowList = new ArrayList<>(memoryCache.getValues());
if (rowList.isEmpty()) {
return true;
}
rowList.sort(Comparator.comparingInt(AspectUrlCountVo::getStartCount));
System.out.println(CollectionString.getCollectionString("接口执行次数:", rowList));
return true;
}
......
......@@ -7,11 +7,12 @@ package com.yanzuoguang.cloud.aop;
*/
public class AspectUrlCountVo {
private volatile String url;
private volatile long startCount;
private volatile long endCount;
private volatile int startCount;
private volatile int endCount;
private volatile long totalTime;
private volatile long minTime;
private volatile long maxTime;
private volatile int avgTime;
private volatile int minTime;
private volatile int maxTime;
public AspectUrlCountVo(String url) {
this.url = url;
......@@ -25,19 +26,19 @@ public class AspectUrlCountVo {
this.url = url;
}
public long getStartCount() {
public int getStartCount() {
return startCount;
}
public void setStartCount(long startCount) {
public void setStartCount(int startCount) {
this.startCount = startCount;
}
public long getEndCount() {
public int getEndCount() {
return endCount;
}
public void setEndCount(long endCount) {
public void setEndCount(int endCount) {
this.endCount = endCount;
}
......@@ -49,20 +50,27 @@ public class AspectUrlCountVo {
this.totalTime = totalTime;
}
public long getMinTime() {
public int getAvgTime() {
return avgTime;
}
public void setAvgTime(int avgTime) {
this.avgTime = avgTime;
}
public int getMinTime() {
return minTime;
}
public void setMinTime(long minTime) {
public void setMinTime(int minTime) {
this.minTime = minTime;
}
public long getMaxTime() {
public int getMaxTime() {
return maxTime;
}
public void setMaxTime(long maxTime) {
public void setMaxTime(int maxTime) {
this.maxTime = maxTime;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment