geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r497287 - /geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
Date Thu, 18 Jan 2007 02:11:02 GMT
Author: dain
Date: Wed Jan 17 18:11:02 2007
New Revision: 497287

URL: http://svn.apache.org/viewvc?view=rev&rev=497287
Log:
set thread context class loader

Modified:
    geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java

Modified: geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java?view=diff&rev=497287&r1=497286&r2=497287
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
Wed Jan 17 18:11:02 2007
@@ -47,7 +47,7 @@
 
     public OpenEjbSystemGBean(TransactionManager transactionManager) throws OpenEJBException
{
         if (transactionManager == null) throw new NullPointerException("transactionManager
is null");
-        
+
         configurationFactory = new ConfigurationFactory();
         assembler = new Assembler();
 
@@ -75,19 +75,43 @@
     }
 
     public ClientInfo configureApplication(ClientModule clientModule) throws OpenEJBException
{
-        return configurationFactory.configureApplication(clientModule);
+        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(clientModule.getClassLoader());
+        try {
+            return configurationFactory.configureApplication(clientModule);
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldClassLoader);
+        }
     }
 
     public EjbJarInfo configureApplication(EjbModule ejbModule) throws OpenEJBException {
-        return configurationFactory.configureApplication(ejbModule);
+        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(ejbModule.getClassLoader());
+        try {
+            return configurationFactory.configureApplication(ejbModule);
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldClassLoader);
+        }
     }
 
     public void createClient(ClientInfo clientInfo, ClassLoader classLoader) throws NamingException,
IOException, OpenEJBException {
-        assembler.createClient(clientInfo, classLoader);
+        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(classLoader);
+        try {
+            assembler.createClient(clientInfo, classLoader);
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldClassLoader);
+        }
     }
 
     public void createEjbJar(EjbJarInfo ejbJarInfo, ClassLoader classLoader) throws NamingException,
IOException, OpenEJBException {
-        assembler.createEjbJar(ejbJarInfo, classLoader);
+        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(classLoader);
+        try {
+            assembler.createEjbJar(ejbJarInfo, classLoader);
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldClassLoader);
+        }
     }
 
     public DeploymentInfo getDeploymentInfo(String deploymentId) {



Mime
View raw message