Skip to content

Commit

Permalink
improve ArthasAgent API. alibaba#1471
Browse files Browse the repository at this point in the history
  • Loading branch information
hengyunabc committed Sep 4, 2020
1 parent 41ac103 commit 2d4c59d
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ public class ArthasAgent {
private Instrumentation instrumentation;

public ArthasAgent() {
this(null, null, false, null);
}

public ArthasAgent(Map<String, String> configMap) {
this(configMap, null, false, null);
}

public ArthasAgent(String arthasHome) {
this(null, arthasHome, false, null);
}

public ArthasAgent(Map<String, String> configMap, String arthasHome, boolean slientInit,
Expand All @@ -47,6 +55,22 @@ public static void attach() {
new ArthasAgent().init();
}

/**
* @see https://arthas.aliyun.com/doc/arthas-properties.html
* @param configMap
*/
public static void attach(Map<String, String> 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 {
Expand Down

0 comments on commit 2d4c59d

Please sign in to comment.