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

SvenO3 pushed a commit to branch fix-adapter-producer-lifecycle
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to refs/heads/fix-adapter-producer-lifecycle 
by this push:
     new 5e7089133a Delete resources from monitoring state
5e7089133a is described below

commit 5e7089133ab01abe0917a995551d802eb7a5a97b
Author: Sven Oehler <[email protected]>
AuthorDate: Mon Jul 13 17:21:45 2026 +0200

    Delete resources from monitoring state
---
 .../api/monitoring/SpMonitoringManager.java        | 26 ++++++++--------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git 
a/streampipes-extensions-api/src/main/java/org/apache/streampipes/extensions/api/monitoring/SpMonitoringManager.java
 
b/streampipes-extensions-api/src/main/java/org/apache/streampipes/extensions/api/monitoring/SpMonitoringManager.java
index e3fb7d79ba..da0a7762c3 100644
--- 
a/streampipes-extensions-api/src/main/java/org/apache/streampipes/extensions/api/monitoring/SpMonitoringManager.java
+++ 
b/streampipes-extensions-api/src/main/java/org/apache/streampipes/extensions/api/monitoring/SpMonitoringManager.java
@@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 public enum SpMonitoringManager {
 
@@ -39,16 +40,13 @@ public enum SpMonitoringManager {
   private final Map<String, SpMetricsEntry> metricsInfos;
 
   SpMonitoringManager() {
-    this.logInfos = new HashMap<>();
-    this.metricsInfos = new HashMap<>();
+    this.logInfos = new ConcurrentHashMap<>();
+    this.metricsInfos = new ConcurrentHashMap<>();
   }
 
   public void addErrorMessage(String resourceId,
                               SpLogEntry errorMessageEntry) {
-    if (!logInfos.containsKey(resourceId)) {
-      logInfos.put(resourceId, new FixedSizeList<>(100));
-    }
-    this.logInfos.get(resourceId).add(errorMessageEntry);
+    this.logInfos.computeIfAbsent(resourceId, key -> new 
FixedSizeList<>(100)).add(errorMessageEntry);
   }
 
   public void increaseInCounter(String resourceId,
@@ -69,19 +67,13 @@ public enum SpMonitoringManager {
     this.metricsInfos.put(resourceId, currentEntry);
   }
 
-  public void resetCounter(String resourceId) {
-    this.metricsInfos.put(resourceId, new SpMetricsEntry());
-  }
-
-  public void resetLogs(String resourceId) {
-    if (this.logInfos.containsKey(resourceId)) {
-      this.logInfos.get(resourceId).clear();
-    }
+  public void reset(String resourceId) {
+    this.remove(resourceId);
   }
 
-  public void reset(String resourceId) {
-    this.resetCounter(resourceId);
-    this.resetLogs(resourceId);
+  public void remove(String resourceId) {
+    this.metricsInfos.remove(resourceId);
+    this.logInfos.remove(resourceId);
   }
 
   public SpMetricsEntry getMetricsEntry(String resourceId,

Reply via email to