|
|
|
@ -1,5 +1,8 @@
|
|
|
|
|
package com.taobao.arthas.boot;
|
|
|
|
|
|
|
|
|
|
import static com.taobao.arthas.boot.ProcessUtils.STATUS_EXEC_ERROR;
|
|
|
|
|
import static com.taobao.arthas.boot.ProcessUtils.STATUS_EXEC_TIMEOUT;
|
|
|
|
|
|
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
@ -11,12 +14,12 @@ import java.security.CodeSource;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.InputMismatchException;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Scanner;
|
|
|
|
|
import java.util.TimeZone;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
import java.util.logging.Level;
|
|
|
|
|
import java.util.InputMismatchException;
|
|
|
|
|
|
|
|
|
|
import javax.xml.parsers.ParserConfigurationException;
|
|
|
|
|
|
|
|
|
@ -36,9 +39,6 @@ import com.taobao.middleware.cli.annotations.Name;
|
|
|
|
|
import com.taobao.middleware.cli.annotations.Option;
|
|
|
|
|
import com.taobao.middleware.cli.annotations.Summary;
|
|
|
|
|
|
|
|
|
|
import static com.taobao.arthas.boot.ProcessUtils.STATUS_EXEC_ERROR;
|
|
|
|
|
import static com.taobao.arthas.boot.ProcessUtils.STATUS_EXEC_TIMEOUT;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author hengyunabc 2018-10-26
|
|
|
|
|
*
|
|
|
|
@ -57,6 +57,7 @@ import static com.taobao.arthas.boot.ProcessUtils.STATUS_EXEC_TIMEOUT;
|
|
|
|
|
+ " java -jar arthas-boot.jar --versions\n"
|
|
|
|
|
+ " java -jar arthas-boot.jar --select math-game\n"
|
|
|
|
|
+ " java -jar arthas-boot.jar --session-timeout 3600\n" + " java -jar arthas-boot.jar --attach-only\n"
|
|
|
|
|
+ " java -jar arthas-boot.jar --disabled-commands stop,dump\n"
|
|
|
|
|
+ " java -jar arthas-boot.jar --repo-mirror aliyun --use-http\n" + "WIKI:\n"
|
|
|
|
|
+ " https://arthas.aliyun.com/doc\n")
|
|
|
|
|
public class Bootstrap {
|
|
|
|
@ -128,6 +129,8 @@ public class Bootstrap {
|
|
|
|
|
|
|
|
|
|
private String select;
|
|
|
|
|
|
|
|
|
|
private String disabledCommands;
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
|
ARTHAS_LIB_DIR = new File(
|
|
|
|
|
System.getProperty("user.home") + File.separator + ".arthas" + File.separator + "lib");
|
|
|
|
@ -293,6 +296,12 @@ public class Bootstrap {
|
|
|
|
|
this.select = select;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Option(longName = "disabled-commands")
|
|
|
|
|
@Description("disable some commands ")
|
|
|
|
|
public void setDisabledCommands(String disabledCommands) {
|
|
|
|
|
this.disabledCommands = disabledCommands;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException,
|
|
|
|
|
ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalAccessException,
|
|
|
|
|
IllegalArgumentException, InvocationTargetException {
|
|
|
|
@ -547,6 +556,11 @@ public class Bootstrap {
|
|
|
|
|
attachArgs.add(bootstrap.getStatUrl());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bootstrap.getDisabledCommands() != null){
|
|
|
|
|
attachArgs.add("-disabled-commands");
|
|
|
|
|
attachArgs.add(bootstrap.getDisabledCommands());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AnsiLog.info("Try to attach process " + pid);
|
|
|
|
|
AnsiLog.debug("Start arthas-core.jar args: " + attachArgs);
|
|
|
|
|
ProcessUtils.startArthasCore(pid, attachArgs);
|
|
|
|
@ -849,4 +863,8 @@ public class Bootstrap {
|
|
|
|
|
public String getPassword() {
|
|
|
|
|
return password;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getDisabledCommands() {
|
|
|
|
|
return disabledCommands;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|