// fix me
// move this code to a common place which is being worked on by Kedar
// connection info
JMXConnectorConfig jcc = getJMXConnectorInfo(configContext, instanceName);
// url
JMXServiceURL url = null;
/* Currently this is totally hacked code. - May 2004.
This should clearly use a pool of connectors.
The pool of connectors should be created early in the life cycle.
*/
try {
url = JmxServiceUrlFactory.forRmiWithJndiInAppserver
(jcc.getHost(), Integer.parseInt(jcc.getPort()));
}
catch(final Exception e) {
throw new RuntimeException(e);
}
final Map env = new HashMap();
// add user and password based on Abhijit's patch
env.put(JMXConnector.CREDENTIALS, new String[] {jcc.getUser(), jcc.getPassword()});
// connection
JMXConnector conn = JMXConnectorFactory.connect(url, env);
return conn;
}