From dc57aae0e6cdf31cd973e50624dee32b47478abd Mon Sep 17 00:00:00 2001 From: Elias Ross Date: Tue, 20 May 2014 09:22:05 -0700 Subject: [PATCH] Allow classloader to be passed into EMS advanced properties Removes an unnecessary cast Example: ClassLoader ccl = Thread.currentThread().getContextClassLoader(); Properties p = new Properties(); p.put(JMXConnectorFactory.DEFAULT_CLASS_LOADER, ccl); ConnectionSettings connectionSettings = new ConnectionSettings(); connectionSettings.setAdvancedProperties(p); ConnectionFactory connectionFactory = new ConnectionFactory(); ConnectionProvider connectionProvider = connectionFactory.getConnectionProvider(connectionSettings); --- .../support/providers/JMXRemotingConnectionProvider.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ems-impl/org/mc4j/ems/impl/jmx/connection/support/providers/JMXRemotingConnectionProvider.java b/src/ems-impl/org/mc4j/ems/impl/jmx/connection/support/providers/JMXRemotingConnectionProvider.java index 3e848b5..6627777 100644 --- a/src/ems-impl/org/mc4j/ems/impl/jmx/connection/support/providers/JMXRemotingConnectionProvider.java +++ b/src/ems-impl/org/mc4j/ems/impl/jmx/connection/support/providers/JMXRemotingConnectionProvider.java @@ -76,7 +76,7 @@ protected void doConnect() { // Create an RMI connector client JMXServiceURL url = new JMXServiceURL(this.connectionSettings.getServerUrl()); - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable(); if ((connectionSettings.getInitialContextName() != null) && (connectionSettings.getInitialContextName().trim().length() > 0)) { @@ -120,8 +120,7 @@ protected void doConnect() { Set> entries = connectionSettings.getAdvancedProperties().entrySet(); for (Map.Entry entry : entries) { String key = (String) entry.getKey(); - String value = (String) entry.getValue(); - + Object value = entry.getValue(); env.put(key, value); } }