[jboss-cvs] JBossAS SVN: r76864 - projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Aug 10 17:15:50 EDT 2008


Author: ALRubinger
Date: 2008-08-10 17:15:48 -0400 (Sun, 10 Aug 2008)
New Revision: 76864

Modified:
   projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/SessionProxyFactoryBase.java
Log:
[EJBTHREE-1345] Use the TCL, if possible, for generating business interface proxies (required to support web injection where an isolated CL is place)

Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/SessionProxyFactoryBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/SessionProxyFactoryBase.java	2008-08-10 16:08:04 UTC (rev 76863)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/factory/session/SessionProxyFactoryBase.java	2008-08-10 21:15:48 UTC (rev 76864)
@@ -101,7 +101,7 @@
     *   upon which Proxies will invoke
     * @param containerGuid The globally-unique name of the container
     * @param metadata The metadata representing this Session Bean
-    * @param classloader The ClassLoader associated with the SessionContainer
+    * @param classloader The ClassLoader associated with the Container's Bean Class
     *       for which this ProxyFactory is to generate Proxies
     * @param advisor The Advisor for proxies created by this factory
     */
@@ -197,6 +197,27 @@
          // Obtain the correct business proxy constructor
          Constructor<?> constructor = this.getConstructorsProxySpecificBusinessInterface().get(
                businessInterfaceName.trim());
+         
+         /*
+          * In place for web injection (isolated CL)
+          */
+         ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+         try
+         {
+            // See if we can get at the bean class from the TCL
+            Class<?> businessInterfaceClass = Class.forName(businessInterfaceName,false,tcl);
+            
+            // If so, use the TCL to generate the Proxy class, not the Container CL
+            Set<Class<?>> businessInterfaces = new HashSet<Class<?>>();
+            businessInterfaces.add(businessInterfaceClass);
+            constructor = this.createProxyConstructor(businessInterfaces, tcl);
+            
+         }
+         catch(ClassNotFoundException cce)
+         {
+            // Ignore
+         }
+         
 
          // Ensure the constructor was found
          assert constructor != null : "No business proxy constructor for \"" + businessInterfaceName




More information about the jboss-cvs-commits mailing list