This is an automated email from the ASF dual-hosted git repository.

zyk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 2122ae3353 [IOTDB-5404] Fix concurrency problem of metricSets in 
AbstractMetricService (#8841)
2122ae3353 is described below

commit 2122ae33539663f3d0fb1dd24df575c3b39008ef
Author: ZhangHongYin <[email protected]>
AuthorDate: Thu Jan 12 14:26:44 2023 +0800

    [IOTDB-5404] Fix concurrency problem of metricSets in AbstractMetricService 
(#8841)
---
 .../src/main/java/org/apache/iotdb/metrics/AbstractMetricService.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/metrics/interface/src/main/java/org/apache/iotdb/metrics/AbstractMetricService.java
 
b/metrics/interface/src/main/java/org/apache/iotdb/metrics/AbstractMetricService.java
index f8b410e2a8..b0329319a0 100644
--- 
a/metrics/interface/src/main/java/org/apache/iotdb/metrics/AbstractMetricService.java
+++ 
b/metrics/interface/src/main/java/org/apache/iotdb/metrics/AbstractMetricService.java
@@ -47,6 +47,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.ServiceLoader;
@@ -67,7 +68,7 @@ public abstract class AbstractMetricService {
   protected IoTDBInternalReporter internalReporter = new 
IoTDBInternalMemoryReporter();
 
   /** The list of metric sets. */
-  protected List<IMetricSet> metricSets = new ArrayList<>();
+  protected List<IMetricSet> metricSets = Collections.synchronizedList(new 
ArrayList<>());
 
   public AbstractMetricService() {
     // empty constructor

Reply via email to