[seam-commits] Seam SVN: r8006 - trunk/src/main/org/jboss/seam.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Apr 22 21:53:12 EDT 2008


Author: shane.bryzak at jboss.com
Date: 2008-04-22 21:53:12 -0400 (Tue, 22 Apr 2008)
New Revision: 8006

Modified:
   trunk/src/main/org/jboss/seam/Seam.java
Log:
JBSEAM-2917 optimized cache initialization

Modified: trunk/src/main/org/jboss/seam/Seam.java
===================================================================
--- trunk/src/main/org/jboss/seam/Seam.java	2008-04-23 01:51:30 UTC (rev 8005)
+++ trunk/src/main/org/jboss/seam/Seam.java	2008-04-23 01:53:12 UTC (rev 8006)
@@ -11,7 +11,9 @@
 import static org.jboss.seam.util.EJB.STATELESS;
 import static org.jboss.seam.util.EJB.name;
 
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
 import javax.persistence.Entity;
@@ -40,6 +42,7 @@
     
    private static final Map<Class, String> COMPONENT_NAME_CACHE = new ConcurrentHashMap<Class, String>();
    private static final Map<Class, EjbDescriptor> EJB_DESCRIPTOR_CACHE = new ConcurrentHashMap<Class, EjbDescriptor>();
+   private static final Set<ClassLoader> CLASSLOADERS_LOADED = new HashSet<ClassLoader>(); 
 
    private static EjbDescriptor getEjbDescriptor(Class clazz)
    {
@@ -48,12 +51,16 @@
       {
           return info;
       }
-      else
+      else if (clazz.getClassLoader() == null || 
+         (clazz.getClassLoader() != null && !CLASSLOADERS_LOADED.contains(clazz.getClassLoader())))
       {
          Map<Class, EjbDescriptor> ejbDescriptors = new DeploymentDescriptor(clazz).getEjbDescriptors();
          EJB_DESCRIPTOR_CACHE.putAll(ejbDescriptors);
+         CLASSLOADERS_LOADED.add(clazz.getClassLoader());
          return ejbDescriptors.get(clazz);
       }
+      
+      return null;      
    }
   
    /**
@@ -313,6 +320,7 @@
    {
       COMPONENT_NAME_CACHE.clear();
       EJB_DESCRIPTOR_CACHE.clear();
+      CLASSLOADERS_LOADED.clear();
    }
    
 }




More information about the seam-commits mailing list