You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2021/08/24 08:58:30 UTC
[karaf] branch karaf-4.2.x updated: [KARAF-7231] Remove DESTROYED
blueprint containers from states map
This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch karaf-4.2.x
in repository https://gitbox.apache.org/repos/asf/karaf.git
The following commit(s) were added to refs/heads/karaf-4.2.x by this push:
new 63266c1 [KARAF-7231] Remove DESTROYED blueprint containers from states map
63266c1 is described below
commit 63266c1f6f413e5d296d72f9a65dda632cec3caf
Author: Jean-Baptiste Onofré <jb...@apache.org>
AuthorDate: Mon Aug 9 07:05:11 2021 +0200
[KARAF-7231] Remove DESTROYED blueprint containers from states map
(cherry picked from commit 6ba8d90a8bb99c6c5bad82cc3fced2e9b5b2be72)
---
.../bundle/state/blueprint/internal/BlueprintStateService.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/bundle/blueprintstate/src/main/java/org/apache/karaf/bundle/state/blueprint/internal/BlueprintStateService.java b/bundle/blueprintstate/src/main/java/org/apache/karaf/bundle/state/blueprint/internal/BlueprintStateService.java
index 8646d0e..b9bd148 100644
--- a/bundle/blueprintstate/src/main/java/org/apache/karaf/bundle/state/blueprint/internal/BlueprintStateService.java
+++ b/bundle/blueprintstate/src/main/java/org/apache/karaf/bundle/state/blueprint/internal/BlueprintStateService.java
@@ -103,7 +103,12 @@ public class BlueprintStateService implements org.osgi.service.blueprint.contain
LOG.debug("Blueprint app state changed to " + state + " for bundle "
+ blueprintEvent.getBundle().getBundleId());
}
- states.put(blueprintEvent.getBundle().getBundleId(), blueprintEvent);
+ // DESTROYED blueprint containers should be removed from the map to avoid memory "leak/high consumption"
+ if (blueprintEvent.getType() == BlueprintEvent.DESTROYED) {
+ states.remove(blueprintEvent.getBundle().getBundleId());
+ } else {
+ states.put(blueprintEvent.getBundle().getBundleId(), blueprintEvent);
+ }
}
@Override