This is an automated email from the ASF dual-hosted git repository. struberg pushed a commit to branch cdi-2.0 in repository https://gitbox.apache.org/repos/asf/openwebbeans.git
commit 150a311198a11999566eaa1b6f4fb5623ea2fd4e Author: Sebastian Schlatow <sebastian.schla...@cewe.de> AuthorDate: Tue Sep 7 17:37:14 2021 +0200 OWB-1389 Remove destroyed instance from memory --- .../webbeans/web/tomcat7/TomcatInstanceManager.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat7/TomcatInstanceManager.java b/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat7/TomcatInstanceManager.java index eb127e6..f9a8d46 100644 --- a/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat7/TomcatInstanceManager.java +++ b/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat7/TomcatInstanceManager.java @@ -47,7 +47,7 @@ public class TomcatInstanceManager implements InstanceManager @Override public void destroyInstance(Object instance) throws IllegalAccessException, InvocationTargetException { - Object injectorInstance = objects.get(instance); + Object injectorInstance = this.objects.get(instance); if (injectorInstance != null) { try @@ -60,10 +60,15 @@ public class TomcatInstanceManager implements InstanceManager } catch (Exception e) { - log.error("Erros is occured while destroying the OpenWebBeans injector instance", e); + log.error("Error is occured while destroying the OpenWebBeans injector instance", e); } } this.processor.destroyInstance(instance); + this.objects.remove(instance); + if (log.isDebugEnabled()) + { + log.debug("Number of 'objects' map entries after destroying instance: " + this.objects.size()); + } } @Override @@ -122,7 +127,11 @@ public class TomcatInstanceManager implements InstanceManager Object injectorInstance = TomcatUtil.inject(object, loader); if (injectorInstance != null) { - objects.put(object, injectorInstance); + this.objects.put(object, injectorInstance); + } + if (log.isDebugEnabled()) + { + log.debug("Number of 'objects' map entries after injecting instance: " + this.objects.size()); } } catch (Exception e)