This is an automated email from the ASF dual-hosted git repository. domgarguilo pushed a commit to branch 2.1 in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push: new e733bd30e2 Make the Monitor.EventCounter class thread safe (#4959) e733bd30e2 is described below commit e733bd30e2cece23e8dc13ffb0edce0e9f3ed021 Author: Dom G. <domgargu...@apache.org> AuthorDate: Tue Oct 8 17:27:56 2024 -0400 Make the Monitor.EventCounter class thread safe (#4959) * fixes a bug where ConcurrentModificationException was seen --- .../src/main/java/org/apache/accumulo/monitor/Monitor.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java index 9957164153..a4bb9f76d7 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java @@ -197,11 +197,11 @@ public class Monitor extends AbstractServer implements HighlyAvailableService { Map<String,Pair<Long,Long>> samples = new HashMap<>(); Set<String> serversUpdated = new HashSet<>(); - void startingUpdates() { + synchronized void startingUpdates() { serversUpdated.clear(); } - void updateTabletServer(String name, long sampleTime, long numEvents) { + synchronized void updateTabletServer(String name, long sampleTime, long numEvents) { Pair<Long,Long> newSample = new Pair<>(sampleTime, numEvents); Pair<Long,Long> lastSample = samples.get(name); @@ -214,13 +214,13 @@ public class Monitor extends AbstractServer implements HighlyAvailableService { serversUpdated.add(name); } - void finishedUpdating() { + synchronized void finishedUpdating() { // remove any tablet servers not updated samples.keySet().retainAll(serversUpdated); prevSamples.keySet().retainAll(serversUpdated); } - double calculateRate() { + synchronized double calculateRate() { double totalRate = 0; for (Entry<String,Pair<Long,Long>> entry : prevSamples.entrySet()) { @@ -234,7 +234,7 @@ public class Monitor extends AbstractServer implements HighlyAvailableService { return totalRate; } - long calculateCount() { + synchronized long calculateCount() { long count = 0; for (Entry<String,Pair<Long,Long>> entry : prevSamples.entrySet()) {