Make versionPointCache thread-safe
@@ -10,6 +10,7 @@ import java.time.Duration;
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
/**
@@ -23,7 +24,7 @@ public class DocumentApiMetrics {
private final Gauge feedLatency;
private final Counter feedRequests;
private final Map<DocumentOperationStatus, Map<DocumentOperationType, Point>> points = new HashMap<>();
- private final Map<String, Point> versionPointCache = new HashMap<>();
+ private final Map<String, Point> versionPointCache = new ConcurrentHashMap<>();
public DocumentApiMetrics(MetricReceiver metricReceiver, String apiName) {
Map<String, String> dimensions = new HashMap<>();
