Update of /cvsroot/mx4j/mx4j/src/core/mx4j/remote
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31912/core/mx4j/remote
Modified Files:
ConnectionResolver.java
Log Message:
Fix for bug #907629: now using the same classloader mechanism of the provider to lookup the resolver
Index: ConnectionResolver.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/core/mx4j/remote/ConnectionResolver.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ConnectionResolver.java 18 Sep 2003 18:42:56 -0000 1.1
--- ConnectionResolver.java 1 Mar 2004 18:13:13 -0000 1.2
***************
*** 14,17 ****
--- 14,18 ----
import javax.management.remote.JMXServiceURL;
+ import javax.management.remote.JMXConnectorServerFactory;
import mx4j.log.Logger;
***************
*** 38,46 ****
* Returns a subclass of ConnectionResolver for the specified protocol.
*/
! public static ConnectionResolver getInstance(String proto)
{
String protocol = normalizeProtocol(proto);
String resolverPackages = findResolverPackageList();
! return loadResolver(resolverPackages, protocol, Thread.currentThread().getContextClassLoader());
}
--- 39,48 ----
* Returns a subclass of ConnectionResolver for the specified protocol.
*/
! public static ConnectionResolver newConnectionResolver(String proto, Map environment)
{
String protocol = normalizeProtocol(proto);
String resolverPackages = findResolverPackageList();
! ClassLoader classLoader = findResolverClassLoader(environment, JMXConnectorServerFactory.PROTOCOL_PROVIDER_CLASS_LOADER);
! return loadResolver(resolverPackages, protocol, classLoader);
}
***************
*** 57,60 ****
--- 59,71 ----
}
+ private static ClassLoader findResolverClassLoader(Map environment, String loaderKey)
+ {
+ if (environment == null) return Thread.currentThread().getContextClassLoader();
+ Object object = environment.get(loaderKey);
+ if (object == null) return Thread.currentThread().getContextClassLoader();
+ if (object != null && !(object instanceof ClassLoader)) throw new IllegalArgumentException("Environment property " + loaderKey + " must be a ClassLoader");
+ return (ClassLoader)object;
+ }
+
private static ConnectionResolver loadResolver(String packages, String protocol, ClassLoader loader)
{
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.