openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1075417 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/config/ webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/ webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/ webbeans-osgi...
Date Mon, 28 Feb 2011 16:43:54 GMT
Author: struberg
Date: Mon Feb 28 16:43:54 2011
New Revision: 1075417

URL: http://svn.apache.org/viewvc?rev=1075417&view=rev
Log:
OWB-535 release ScannerService resources once we don't need them anymore

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/WebBeansScannerTest.java
    openwebbeans/trunk/webbeans-osgi/src/main/java/org/apache/webbeans/osgi/scanner/OsgiMetaDataScannerService.java
    openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ScannerService.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=1075417&r1=1075416&r2=1075417&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
Mon Feb 28 16:43:54 2011
@@ -177,7 +177,8 @@ public class BeansDeployer
                 
                 //Fire Event
                 fireAfterDeploymentValidationEvent();
-                
+
+                scanner.release();
                 deployed = true;
             }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java?rev=1075417&r1=1075416&r2=1075417&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
Mon Feb 28 16:43:54 2011
@@ -57,6 +57,11 @@ public abstract class AbstractMetaDataDi
 
     protected AbstractMetaDataDiscovery()
     {
+        initAnnotationDB();
+    }
+
+    private void initAnnotationDB()
+    {
         try
         {
             annotationDB = new AnnotationDB();
@@ -69,9 +74,9 @@ public abstract class AbstractMetaDataDi
         catch(Exception e)
         {
             throw new WebBeansDeploymentException(e);
-        }                
+        }
     }
-    
+
     /**
      * Configure the Web Beans Container with deployment information and fills
      * annotation database and beans.xml stream database.
@@ -89,8 +94,13 @@ public abstract class AbstractMetaDataDi
             throw new WebBeansDeploymentException(e);
         }
     }
-    
-    
+
+    @Override
+    public void release()
+    {
+        initAnnotationDB();
+    }
+
     abstract protected void configure() throws Exception;
 
     /**

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/WebBeansScannerTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/WebBeansScannerTest.java?rev=1075417&r1=1075416&r2=1075417&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/WebBeansScannerTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/WebBeansScannerTest.java
Mon Feb 28 16:43:54 2011
@@ -24,6 +24,7 @@ import java.util.Set;
 
 import junit.framework.Assert;
 
+import org.apache.webbeans.lifecycle.test.OpenWebBeansTestMetaDataDiscoveryService;
 import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.apache.webbeans.spi.ScannerService;
 
@@ -41,11 +42,15 @@ public class WebBeansScannerTest extends
     {
         List<Class<?>> classes = new ArrayList<Class<?>>();
         classes.add(ScannerTestBean.class);
-        
+
         //Start test container
         startContainer(classes);
-        
-        ScannerService scanner = getWebBeansContext().getScannerService();
+
+        OpenWebBeansTestMetaDataDiscoveryService scanner = (OpenWebBeansTestMetaDataDiscoveryService)
getWebBeansContext().getScannerService();
+        scanner.deployClasses(classes);
+
+        scanner.scan();
+
         Set<Class<?>> classMap = scanner.getBeanClasses();
         Assert.assertNotNull(classMap);
         Assert.assertFalse(classMap.isEmpty());

Modified: openwebbeans/trunk/webbeans-osgi/src/main/java/org/apache/webbeans/osgi/scanner/OsgiMetaDataScannerService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-osgi/src/main/java/org/apache/webbeans/osgi/scanner/OsgiMetaDataScannerService.java?rev=1075417&r1=1075416&r2=1075417&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-osgi/src/main/java/org/apache/webbeans/osgi/scanner/OsgiMetaDataScannerService.java
(original)
+++ openwebbeans/trunk/webbeans-osgi/src/main/java/org/apache/webbeans/osgi/scanner/OsgiMetaDataScannerService.java
Mon Feb 28 16:43:54 2011
@@ -76,6 +76,14 @@ public class OsgiMetaDataScannerService 
     }
 
     @Override
+    public void release()
+    {
+        beanClasses = new HashSet<Class<?>>();
+        beanXMLs = new HashSet<String>();
+        beanArchiveJarNames = new HashSet<String>();
+    }
+
+    @Override
     public void scan() throws WebBeansDeploymentException
     {
         logger.info("Using OsgiMetaDataScannerService!");

Modified: openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ScannerService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ScannerService.java?rev=1075417&r1=1075416&r2=1075417&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ScannerService.java
(original)
+++ openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ScannerService.java
Mon Feb 28 16:43:54 2011
@@ -47,6 +47,14 @@ public interface ScannerService
      */
     public void scan();
 
+
+    /**
+     * This method will get called once the information found by the current
+     * scan is not needed anymore and the ScannerService might free up
+     * resources.
+     */
+    public void release();
+
     
     /**
      * Gets xml configuration files that are occured



Mime
View raw message