From d3c8be33bd437141f887414be47e4b2df27e5f13 Mon Sep 17 00:00:00 2001 From: hongqiaowei Date: Thu, 14 Jan 2021 13:44:07 +0800 Subject: [PATCH] refactor: flow control filters v1 --- src/main/java/we/stats/FlowStat.java | 16 ---------------- src/main/java/we/stats/ResourceStat.java | 5 ----- 2 files changed, 21 deletions(-) diff --git a/src/main/java/we/stats/FlowStat.java b/src/main/java/we/stats/FlowStat.java index 9c183e2..0edc865 100644 --- a/src/main/java/we/stats/FlowStat.java +++ b/src/main/java/we/stats/FlowStat.java @@ -27,7 +27,6 @@ import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import org.apache.commons.lang3.exception.ExceptionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -133,20 +132,6 @@ public class FlowStat { return; } ResourceStat resourceStat = getResourceStat(resourceId); - - long concurrents = resourceStat.getConcurrentRequests().get(); - if (concurrents == 0) { - // RuntimeException e = new RuntimeException(); - // log.warn(timeSlotId + " " + resourceId + " concurrents is zero", e); - - StackTraceElement[] stackTraces = Thread.currentThread().getStackTrace(); - StringBuilder b = new StringBuilder(timeSlotId + " " + resourceId + " concurrents is zero\n"); - for (int i = 0; i < stackTraces.length; i++) { - b.append(stackTraces[i].toString()).append('\n'); - } - log.warn(b.toString()); - } - resourceStat.decrConcurrentRequest(timeSlotId); } @@ -173,7 +158,6 @@ public class FlowStat { resourceStat = resourceStats.get(resourceId); } else { resourceStat = new ResourceStat(resourceId); - log.info("no resource stat for " + resourceId + " and create one"); ResourceStat rs = resourceStats.putIfAbsent(resourceId, resourceStat); if (rs != null) { resourceStat = rs; diff --git a/src/main/java/we/stats/ResourceStat.java b/src/main/java/we/stats/ResourceStat.java index 7ac98f6..998649b 100644 --- a/src/main/java/we/stats/ResourceStat.java +++ b/src/main/java/we/stats/ResourceStat.java @@ -117,11 +117,6 @@ public class ResourceStat { */ public void decrConcurrentRequest(long timeSlotId) { long conns = this.concurrentRequests.decrementAndGet(); - - if (conns == -1) { - log.warn(timeSlotId + " concurrents is one"); - } - this.getTimeSlot(timeSlotId).updatePeakConcurrentReqeusts(conns); }