geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r220120 - /geronimo/branches/v1_0_M4-QA/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
Date Thu, 21 Jul 2005 15:58:23 GMT
Author: djencks
Date: Thu Jul 21 08:58:21 2005
New Revision: 220120

URL: http://svn.apache.org/viewcvs?rev=220120&view=rev
Log:
GERONIMO-769 Set TCCL when accessing MCF properties

Modified:
    geronimo/branches/v1_0_M4-QA/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java

Modified: geronimo/branches/v1_0_M4-QA/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/v1_0_M4-QA/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java?rev=220120&r1=220119&r2=220120&view=diff
==============================================================================
--- geronimo/branches/v1_0_M4-QA/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
(original)
+++ geronimo/branches/v1_0_M4-QA/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
Thu Jul 21 08:58:21 2005
@@ -77,6 +77,7 @@
     private final Kernel kernel;
     private final String objectName;
     private final boolean isProxyable;
+    private final ClassLoader classLoader;
 
     //default constructor for enhancement proxy endpoint
     public ManagedConnectionFactoryWrapper() {
@@ -90,6 +91,7 @@
         objectName = null;
         allImplementedInterfaces = null;
         isProxyable = false;
+        classLoader = null;
     }
 
     public ManagedConnectionFactoryWrapper(String managedConnectionFactoryClass,
@@ -133,6 +135,7 @@
         this.connectionManagerContainer = connectionManagerContainer;
 
         //set up that must be done before start
+        classLoader = cl;
         Class clazz = cl.loadClass(managedConnectionFactoryClass);
         managedConnectionFactory = (ManagedConnectionFactory) clazz.newInstance();
         delegate = new DynamicGBeanDelegate();
@@ -255,11 +258,25 @@
 
     //DynamicGBean implementation
     public Object getAttribute(String name) throws Exception {
-        return delegate.getAttribute(name);
+        Thread thread = Thread.currentThread();
+        ClassLoader oldTCL = thread.getContextClassLoader();
+        thread.setContextClassLoader(classLoader);
+        try {
+            return delegate.getAttribute(name);
+        } finally {
+            thread.setContextClassLoader(oldTCL);
+        }
     }
 
     public void setAttribute(String name, Object value) throws Exception {
-        delegate.setAttribute(name, value);
+        Thread thread = Thread.currentThread();
+        ClassLoader oldTCL = thread.getContextClassLoader();
+        thread.setContextClassLoader(classLoader);
+        try {
+            delegate.setAttribute(name, value);
+        } finally {
+            thread.setContextClassLoader(oldTCL);
+        }
     }
 
     public Object invoke(String name, Object[] arguments, String[] types) throws Exception
{



Mime
View raw message