update timeslot while decrease concurrent request

This commit is contained in:
Francis Dong
2020-12-29 16:13:17 +08:00
parent 332eba6351
commit 6496dc8c1f
2 changed files with 4 additions and 3 deletions

View File

@@ -31,7 +31,7 @@ public class FlowStat {
/** /**
* A string Resource ID as key * A string Resource ID as key
*/ */
public ConcurrentMap<String, ResourceStat> resourceStats = new ConcurrentHashMap<>(); public ConcurrentMap<String, ResourceStat> resourceStats = new ConcurrentHashMap<>(100);
/** /**
* Retention time of statistic data * Retention time of statistic data

View File

@@ -22,7 +22,7 @@ public class ResourceStat {
/** /**
* Request count of time slot, the beginning timestamp(timeId) as key * Request count of time slot, the beginning timestamp(timeId) as key
*/ */
private ConcurrentMap<Long, TimeSlot> timeSlots = new ConcurrentHashMap<>(); private ConcurrentMap<Long, TimeSlot> timeSlots = new ConcurrentHashMap<>(100);
/** /**
* Concurrent requests * Concurrent requests
@@ -94,7 +94,8 @@ public class ResourceStat {
* *
*/ */
public void decrConcurrentRequest(long timeSlotId) { public void decrConcurrentRequest(long timeSlotId) {
this.concurrentRequests.decrementAndGet(); long conns = this.concurrentRequests.decrementAndGet();
this.getTimeSlot(timeSlotId).updatePeakConcurrentReqeusts(conns);
} }
/** /**