Cleaning up some horribly written Java code
This commit is contained in:
parent
2161897424
commit
09469b73e1
1 changed files with 5 additions and 9 deletions
|
|
@ -201,12 +201,10 @@ public class Client {
|
||||||
* @param password
|
* @param password
|
||||||
* @return Credentials as map for RMI.
|
* @return Credentials as map for RMI.
|
||||||
*/
|
*/
|
||||||
protected Map formatCredentials(final String login,
|
protected Map<String, Object> formatCredentials(final String login,
|
||||||
final String password) {
|
final String password) {
|
||||||
Map env = null;
|
Map<String, Object> env = new HashMap<String,Object>(1);
|
||||||
String[] creds = new String[] {login, password};
|
env.put(JMXConnector.CREDENTIALS, new String[] {login, password});
|
||||||
env = new HashMap(1);
|
|
||||||
env.put(JMXConnector.CREDENTIALS, creds);
|
|
||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -214,10 +212,8 @@ public class Client {
|
||||||
final String login, final String password)
|
final String login, final String password)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
// Make up the jmx rmi URL and get a connector.
|
// Make up the jmx rmi URL and get a connector.
|
||||||
JMXServiceURL rmiurl = new JMXServiceURL("service:jmx:rmi://"
|
JMXServiceURL rmiurl = new JMXServiceURL("service:jmx:rmi://"+hostport+"/jndi/rmi://"+hostport+"/jmxrmi");
|
||||||
+ hostport + "/jndi/rmi://" + hostport + "/jmxrmi");
|
return JMXConnectorFactory.connect(rmiurl,formatCredentials(login, password));
|
||||||
return JMXConnectorFactory.connect(rmiurl,
|
|
||||||
formatCredentials(login, password));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ObjectName getObjectName(final String beanname)
|
protected ObjectName getObjectName(final String beanname)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue