diff --git a/arthas-agent-attach/src/main/java/com/taobao/arthas/agent/attach/ArthasAgent.java b/arthas-agent-attach/src/main/java/com/taobao/arthas/agent/attach/ArthasAgent.java index 26681b394..805b55080 100644 --- a/arthas-agent-attach/src/main/java/com/taobao/arthas/agent/attach/ArthasAgent.java +++ b/arthas-agent-attach/src/main/java/com/taobao/arthas/agent/attach/ArthasAgent.java @@ -32,7 +32,15 @@ public class ArthasAgent { private Instrumentation instrumentation; public ArthasAgent() { + this(null, null, false, null); + } + + public ArthasAgent(Map configMap) { + this(configMap, null, false, null); + } + public ArthasAgent(String arthasHome) { + this(null, arthasHome, false, null); } public ArthasAgent(Map configMap, String arthasHome, boolean slientInit, @@ -47,6 +55,22 @@ public class ArthasAgent { new ArthasAgent().init(); } + /** + * @see https://arthas.aliyun.com/doc/arthas-properties.html + * @param configMap + */ + public static void attach(Map configMap) { + new ArthasAgent(configMap).init(); + } + + /** + * use the specified arthas + * @param arthasHome arthas directory + */ + public static void attach(String arthasHome) { + new ArthasAgent().init(); + } + public void init() throws IllegalStateException { // 尝试判断arthas是否已在运行,如果是的话,直接就退出 try {