Commit 6dcdfdc0 authored by yanzg's avatar yanzg

修复等待时间

parent 11852664
...@@ -7,6 +7,8 @@ import org.springframework.beans.factory.InitializingBean; ...@@ -7,6 +7,8 @@ import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List; import java.util.List;
/** /**
...@@ -27,6 +29,10 @@ public class AspectLogTime implements ThreadNext.Next, InitializingBean { ...@@ -27,6 +29,10 @@ public class AspectLogTime implements ThreadNext.Next, InitializingBean {
@Override @Override
public boolean next() { public boolean next() {
List<AspectUrlCountVo> rowList = new ArrayList<>(memoryCache.getValues()); List<AspectUrlCountVo> rowList = new ArrayList<>(memoryCache.getValues());
if (rowList.isEmpty()) {
return true;
}
rowList.sort(Comparator.comparingInt(AspectUrlCountVo::getStartCount));
System.out.println(CollectionString.getCollectionString("接口执行次数:", rowList)); System.out.println(CollectionString.getCollectionString("接口执行次数:", rowList));
return true; return true;
} }
......
...@@ -7,11 +7,12 @@ package com.yanzuoguang.cloud.aop; ...@@ -7,11 +7,12 @@ package com.yanzuoguang.cloud.aop;
*/ */
public class AspectUrlCountVo { public class AspectUrlCountVo {
private volatile String url; private volatile String url;
private volatile long startCount; private volatile int startCount;
private volatile long endCount; private volatile int endCount;
private volatile long totalTime; private volatile long totalTime;
private volatile long minTime; private volatile int avgTime;
private volatile long maxTime; private volatile int minTime;
private volatile int maxTime;
public AspectUrlCountVo(String url) { public AspectUrlCountVo(String url) {
this.url = url; this.url = url;
...@@ -25,19 +26,19 @@ public class AspectUrlCountVo { ...@@ -25,19 +26,19 @@ public class AspectUrlCountVo {
this.url = url; this.url = url;
} }
public long getStartCount() { public int getStartCount() {
return startCount; return startCount;
} }
public void setStartCount(long startCount) { public void setStartCount(int startCount) {
this.startCount = startCount; this.startCount = startCount;
} }
public long getEndCount() { public int getEndCount() {
return endCount; return endCount;
} }
public void setEndCount(long endCount) { public void setEndCount(int endCount) {
this.endCount = endCount; this.endCount = endCount;
} }
...@@ -49,20 +50,27 @@ public class AspectUrlCountVo { ...@@ -49,20 +50,27 @@ public class AspectUrlCountVo {
this.totalTime = totalTime; this.totalTime = totalTime;
} }
public long getMinTime() { public int getAvgTime() {
return avgTime;
}
public void setAvgTime(int avgTime) {
this.avgTime = avgTime;
}
public int getMinTime() {
return minTime; return minTime;
} }
public void setMinTime(long minTime) { public void setMinTime(int minTime) {
this.minTime = minTime; this.minTime = minTime;
} }
public long getMaxTime() { public int getMaxTime() {
return maxTime; return maxTime;
} }
public void setMaxTime(long maxTime) { public void setMaxTime(int maxTime) {
this.maxTime = 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