git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1341945 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2012-05-23 16:41:55 +00:00
parent 144dda0308
commit 8b2875e19e
1 changed files with 14 additions and 10 deletions

View File

@ -341,16 +341,20 @@ public abstract class AbstractJmxCommand extends AbstractCommand {
context.print("Connecting to pid: " + pid);
String jmxUrl = findJMXUrlByProcessId(pid);
// If jmx url already specified
if (getJmxServiceUrl() != null) {
context.printException(new IllegalArgumentException("JMX URL already specified."));
tokens.clear();
}
try {
this.setJmxServiceUrl(new JMXServiceURL(jmxUrl));
} catch (MalformedURLException e) {
context.printException(e);
tokens.clear();
if (jmxUrl != null) {
// If jmx url already specified
if (getJmxServiceUrl() != null) {
context.printException(new IllegalArgumentException("JMX URL already specified."));
tokens.clear();
}
try {
this.setJmxServiceUrl(new JMXServiceURL(jmxUrl));
} catch (MalformedURLException e) {
context.printException(e);
tokens.clear();
}
} else {
context.printInfo("failed to resolve jmxUrl for pid:" + pid + ", using default JMX url");
}
} else {
context.printInfo("--pid option is not available for this VM, using default JMX url");