[teiid-commits] teiid SVN: r1142 - in trunk/client/src/main/java/com/metamatrix/common/comm/platform: socket/client and 1 other directory.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Thu Jul 16 15:40:25 EDT 2009


Author: rareddy
Date: 2009-07-16 15:40:24 -0400 (Thu, 16 Jul 2009)
New Revision: 1142

Modified:
   trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
   trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/OioOjbectChannelFactory.java
   trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
   trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
   trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java
Log:
TEIID-721: all the classes in question where proxy was using thread context class loader should be using the current class loader as they will be available in the same class loader for sure.

Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java	2009-07-16 19:28:55 UTC (rev 1141)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/client/ServerAdminFactory.java	2009-07-16 19:40:24 UTC (rev 1142)
@@ -219,7 +219,7 @@
 		p.remove(MMURL.JDBC.VDB_NAME);
 		p.remove(MMURL.JDBC.VDB_VERSION);
     	p.setProperty(MMURL.CONNECTION.AUTO_FAILOVER, Boolean.TRUE.toString());
-		Admin serverAdmin = (Admin)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] { Admin.class }, new ReconnectingProxy(p));
+		Admin serverAdmin = (Admin)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { Admin.class }, new ReconnectingProxy(p));
     	
        return serverAdmin;
     }

Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/OioOjbectChannelFactory.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/OioOjbectChannelFactory.java	2009-07-16 19:28:55 UTC (rev 1141)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/OioOjbectChannelFactory.java	2009-07-16 19:40:24 UTC (rev 1142)
@@ -68,7 +68,7 @@
             //The output stream must be flushed on creation in order to write some initialization data
             //through the buffered stream to the input stream on the other side
             outputStream.flush();
-            final ClassLoader cl = Thread.currentThread().getContextClassLoader();
+            final ClassLoader cl = this.getClass().getClassLoader();
             BufferedInputStream bis = new BufferedInputStream(socket.getInputStream(), STREAM_BUFFER_SIZE);
             inputStream = new ObjectDecoderInputStream(new DataInputStream(bis), cl, MAX_OBJECT_SIZE);
 		}

Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java	2009-07-16 19:28:55 UTC (rev 1141)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnection.java	2009-07-16 19:40:24 UTC (rev 1142)
@@ -242,7 +242,7 @@
 	}
 
 	public <T> T getService(Class<T> iface) {
-		return (T)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {iface}, new ServerConnectionInvocationHandler(iface));
+		return (T)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {iface}, new ServerConnectionInvocationHandler(iface));
 	}
 
 	public synchronized void shutdown() {

Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java	2009-07-16 19:28:55 UTC (rev 1141)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerConnectionFactory.java	2009-07-16 19:40:24 UTC (rev 1142)
@@ -233,7 +233,7 @@
 			key.actual = ssii;
 			key.instance = instanceCount.getAndIncrement();
 			//create a proxied socketserverinstance that will pool itself on shutdown
-			key.proxy = (SocketServerInstance)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {SocketServerInstance.class}, new ShutdownHandler(key));
+			key.proxy = (SocketServerInstance)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {SocketServerInstance.class}, new ShutdownHandler(key));
 			return key.proxy;
 		}
 		return ssii;
@@ -256,7 +256,7 @@
 			discovery = new UrlServerDiscovery();
 		} else {
 			try {
-				discovery = (ServerDiscovery)ReflectionHelper.create(discoveryStrategyName, null, Thread.currentThread().getContextClassLoader());
+				discovery = (ServerDiscovery)ReflectionHelper.create(discoveryStrategyName, null, this.getClass().getClassLoader());
 			} catch (MetaMatrixCoreException e) {
 				throw new ConnectionException(e);
 			}

Modified: trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java
===================================================================
--- trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java	2009-07-16 19:28:55 UTC (rev 1141)
+++ trunk/client/src/main/java/com/metamatrix/common/comm/platform/socket/client/SocketServerInstanceImpl.java	2009-07-16 19:40:24 UTC (rev 1142)
@@ -244,7 +244,7 @@
 	@Override
 	//## JDBC4.0-end ##
 	public <T> T getService(Class<T> iface) {
-		return (T)Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {iface}, new RemoteInvocationHandler(iface));
+		return (T)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {iface}, new RemoteInvocationHandler(iface));
 	}
 	
 	public class RemoteInvocationHandler implements InvocationHandler {



More information about the teiid-commits mailing list