Fix telnet/http port usage

pull/1490/merge^2
gongdewei 4 years ago
parent 23174526c5
commit e0328d48f8

@ -522,7 +522,7 @@ public class Bootstrap {
AnsiLog.info("The target process already listen port {}, skip attach.", bootstrap.getTelnetPortOrDefault()); AnsiLog.info("The target process already listen port {}, skip attach.", bootstrap.getTelnetPortOrDefault());
} else { } else {
//double check telnet port and pid before attach //double check telnet port and pid before attach
if (bootstrap.getTelnetPort() > 0) { if (bootstrap.getTelnetPortOrDefault() > 0) {
telnetPortPid = findProcessByTelnetClient(arthasHomeDir.getAbsolutePath(), bootstrap.getTelnetPortOrDefault()); telnetPortPid = findProcessByTelnetClient(arthasHomeDir.getAbsolutePath(), bootstrap.getTelnetPortOrDefault());
checkTelnetPortPid(bootstrap, telnetPortPid, pid); checkTelnetPortPid(bootstrap, telnetPortPid, pid);
} }
@ -538,14 +538,14 @@ public class Bootstrap {
attachArgs.add(bootstrap.getTargetIp()); attachArgs.add(bootstrap.getTargetIp());
} }
if (bootstrap.getTelnetPort() != null) { if (bootstrap.getTelnetPortOrDefault() > 0) {
attachArgs.add("-telnet-port"); attachArgs.add("-telnet-port");
attachArgs.add("" + bootstrap.getTelnetPort()); attachArgs.add("" + bootstrap.getTelnetPortOrDefault());
} }
if (bootstrap.getHttpPort() != null) { if (bootstrap.getHttpPortOrDefault() > 0) {
attachArgs.add("-http-port"); attachArgs.add("-http-port");
attachArgs.add("" + bootstrap.getHttpPort()); attachArgs.add("" + bootstrap.getHttpPortOrDefault());
} }
attachArgs.add("-core"); attachArgs.add("-core");
@ -600,7 +600,7 @@ public class Bootstrap {
AnsiLog.info("Attach process {} success.", pid); AnsiLog.info("Attach process {} success.", pid);
} }
if (bootstrap.isAttachOnly() || bootstrap.getTelnetPort() <= 0) { if (bootstrap.isAttachOnly() || bootstrap.getTelnetPortOrDefault() <= 0) {
System.exit(0); System.exit(0);
} }

Loading…
Cancel
Save