[weld-commits] Weld SVN: r6803 - in extensions/trunk/impl/src/main/java/org/jboss/weld/extensions: util and 1 other directory.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Sat Jul 24 11:05:22 EDT 2010


Author: pete.muir at jboss.org
Date: 2010-07-24 11:05:21 -0400 (Sat, 24 Jul 2010)
New Revision: 6803

Modified:
   extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericBeanExtension.java
   extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/Synthetic.java
Log:
make a start at cleanup

Modified: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericBeanExtension.java
===================================================================
--- extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericBeanExtension.java	2010-07-24 14:43:04 UTC (rev 6802)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericBeanExtension.java	2010-07-24 15:05:21 UTC (rev 6803)
@@ -34,6 +34,7 @@
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.Produces;
 import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
 import javax.enterprise.inject.spi.AnnotatedConstructor;
 import javax.enterprise.inject.spi.AnnotatedField;
 import javax.enterprise.inject.spi.AnnotatedMethod;
@@ -65,13 +66,16 @@
 class GenericBeanExtension implements Extension
 {
 
+   // A map of generic configuration types to generic beans
    private final Map<Class<?>, Set<AnnotatedType<?>>> genericTypes;
 
+   // A map of classes containing producers which produce generic beans
    private final Map<Class<?>, Map<Member, Annotation>> producers;
 
-   // A map of a generic annotation type to all instances of that type found on beans
+   // A map of a generic configuration types to all instances of that type found
    private final Map<Class<?>, Set<Annotation>> concreteGenerics;
    
+   // A map of generic configuration annotations to generic configuration beans
    private final Map<Annotation, Bean<?>> genericConfigurationBeans;
 
    private final Synthetic.Provider syntheticProvider;
@@ -304,5 +308,15 @@
          return syntheticProvider.get(genericConfiguration);
       }
    }
+   
+   void cleanup(@Observes AfterDeploymentValidation event)
+   {
+      // Defensively clear maps to help with GC
+      this.concreteGenerics.clear();
+      this.genericConfigurationBeans.clear();
+      this.genericTypes.clear();
+      // TODO this.producers.clear();
+      // TODO this.syntheticProvider.clear();
+   }
 
 }

Modified: extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/Synthetic.java
===================================================================
--- extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/Synthetic.java	2010-07-24 14:43:04 UTC (rev 6802)
+++ extensions/trunk/impl/src/main/java/org/jboss/weld/extensions/util/Synthetic.java	2010-07-24 15:05:21 UTC (rev 6803)
@@ -114,6 +114,11 @@
       {
          return new Synthetic.SyntheticLiteral(namespace, count.getAndIncrement());
       }
+      
+      public void clear()
+      {
+         this.synthetics.clear();
+      }
    }
 
 }



More information about the weld-commits mailing list