You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by zy...@apache.org on 2023/01/12 06:27:07 UTC

[iotdb] branch rel/1.0 updated: [To rel/1.0][IOTDB-5404] Fix concurrency problem of metricSets in AbstractMetricService (#8842)

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

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


The following commit(s) were added to refs/heads/rel/1.0 by this push:
     new 414c3eca76 [To rel/1.0][IOTDB-5404] Fix concurrency problem of metricSets in AbstractMetricService (#8842)
414c3eca76 is described below

commit 414c3eca76fa894096e7d7b462fd6b67beb77c95
Author: ZhangHongYin <46...@users.noreply.github.com>
AuthorDate: Thu Jan 12 14:27:00 2023 +0800

    [To rel/1.0][IOTDB-5404] Fix concurrency problem of metricSets in AbstractMetricService (#8842)
---
 .../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