WANG 5 năm trước cách đây
mục cha
commit
4fc59707d5

+ 6 - 2
src/main/java/cn/com/qmth/examcloud/web/actuator/ApiStatusInfoCollector.java

@@ -16,13 +16,17 @@ import cn.com.qmth.examcloud.web.support.ApiInfoHolder;
 @Component
 public class ApiStatusInfoCollector {
 
-	public synchronized List<ApiStatusInfo> collect(ReportInfo reportInfo) {
+	private static String algorithm;
 
+	{
 		// 耗时直方图算法:U:uniform ; B:biased
-		String algorithm = PropertyHolder.getString("$API.statistic.histograms.algorithm", "B");
+		algorithm = PropertyHolder.getString("$API.statistic.histograms.algorithm", "B");
 		if (!(algorithm.equals("B") || algorithm.equals("U"))) {
 			throw new RuntimeException("histograms algorithm must be 'U' or 'B'");
 		}
+	}
+
+	public synchronized List<ApiStatusInfo> collect(ReportInfo reportInfo) {
 
 		List<HistogramInfo> histogramInfoList = reportInfo.getHistogramInfoList();
 		List<MeterInfo> meterInfoList = reportInfo.getMeterInfoList();