openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1724539 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultApplicationBoundaryService.java
Date Thu, 14 Jan 2016 07:39:57 GMT
Author: struberg
Date: Thu Jan 14 07:39:56 2016
New Revision: 1724539

URL: http://svn.apache.org/viewvc?rev=1724539&view=rev
Log:
OWB-1103 add JavaDoc and make it easier to subclass

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultApplicationBoundaryService.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultApplicationBoundaryService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultApplicationBoundaryService.java?rev=1724539&r1=1724538&r2=1724539&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultApplicationBoundaryService.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultApplicationBoundaryService.java
Thu Jan 14 07:39:56 2016
@@ -29,14 +29,29 @@ import org.apache.webbeans.spi.Applicati
 /**
  * Really simple default impl of the ApplicationBoundaryService.
  * Assumes that there is a pretty easy ClassLoader structure in place.
+ * If a proxy should get created for a class further outside of the
+ * {@link #applicationClassLoader} then the {@link #applicationClassLoader}
+ * itself will get used to prevent mem leaks.
  */
 public class DefaultApplicationBoundaryService implements ApplicationBoundaryService, Closeable
 {
-    private final ClassLoader applicationClassLoader;
-    private final Set<ClassLoader> parentClassLoaders;
+    /**
+     * The outermost ClassLoader of the appliction. E.g. the EAR classloader
+     */
+    private ClassLoader applicationClassLoader;
+
+    /**
+     * All ClassLoaders further outside of the {@link #applicationClassLoader}.
+     */
+    private Set<ClassLoader> parentClassLoaders;
 
     public DefaultApplicationBoundaryService()
     {
+        init();
+    }
+
+    protected void init()
+    {
         applicationClassLoader = BeanManagerImpl.class.getClassLoader();
         parentClassLoaders = new HashSet<ClassLoader>();
         ClassLoader cl = applicationClassLoader;
@@ -45,6 +60,7 @@ public class DefaultApplicationBoundaryS
             cl = cl.getParent();
             parentClassLoaders.add(cl);
         }
+
     }
 
     @Override
@@ -74,6 +90,9 @@ public class DefaultApplicationBoundaryS
 
         if (isOutsideOfApplicationClassLoader(classToProxyCl))
         {
+            // note: this logic only works if you have a hieararchic ClassLoader scenario
+            // It doesn't work for e.g. OSGi environments where the CLs are spread out
+            // with very limited visibility
             return appCl;
         }
 



Mime
View raw message