geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r219811 - /geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
Date Tue, 19 Jul 2005 23:34:40 GMT
Author: djencks
Date: Tue Jul 19 16:34:39 2005
New Revision: 219811

URL: http://svn.apache.org/viewcvs?rev=219811&view=rev
Log:
GERONIMO-769 Need correct TCCL for get/set attributes

Modified:
    geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java

Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java?rev=219811&r1=219810&r2=219811&view=diff
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
(original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
Tue Jul 19 16:34:39 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