From 665e944fbe14e7f1d2741087b514e1a04707bdef Mon Sep 17 00:00:00 2001 From: hengyunabc Date: Thu, 31 Oct 2019 11:00:56 +0800 Subject: [PATCH] update docs about stop/shutdown. #838 --- bin/as.sh | 4 ++-- boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java | 4 ++-- .../taobao/arthas/core/command/basic1000/GrepCommand.java | 6 ++++++ site/src/site/sphinx/advanced-use.md | 2 +- site/src/site/sphinx/commands.md | 2 +- site/src/site/sphinx/en/advanced-use.md | 6 +++--- site/src/site/sphinx/en/manual-install.md | 2 +- site/src/site/sphinx/en/quick-start.md | 2 +- site/src/site/sphinx/en/reset.md | 2 +- site/src/site/sphinx/manual-install.md | 2 +- site/src/site/sphinx/quick-start.md | 2 +- site/src/site/sphinx/reset.md | 2 +- 12 files changed, 21 insertions(+), 15 deletions(-) diff --git a/bin/as.sh b/bin/as.sh index 5b42a6d3f..66a14defd 100755 --- a/bin/as.sh +++ b/bin/as.sh @@ -681,13 +681,13 @@ parse_arguments() # check the process already using telnet port if equals to target pid if [[ ($telnetPortPid) && ($TARGET_PID != $telnetPortPid) ]]; then echo "[ERROR] Target process $TARGET_PID is not the process using port $TELNET_PORT, you will connect to an unexpected process." - echo "[ERROR] 1. Try to restart as.sh, select process $telnetPortPid, shutdown it first with running the 'shutdown' command." + echo "[ERROR] 1. Try to restart as.sh, select process $telnetPortPid, shutdown it first with running the 'stop' command." echo "[ERROR] 2. Try to use different telnet port, for example: as.sh --telnet-port 9998 --http-port -1" exit 1 fi if [[ ($httpPortPid) && ($TARGET_PID != $httpPortPid) ]]; then echo "Target process $TARGET_PID is not the process using port $HTTP_PORT, you will connect to an unexpected process." - echo "1. Try to restart as.sh, select process $httpPortPid, shutdown it first with running the 'shutdown' command." + echo "1. Try to restart as.sh, select process $httpPortPid, shutdown it first with running the 'stop' command." echo "2. Try to use different http port, for example: as.sh --telnet-port 9998 --http-port 9999" exit 1 fi diff --git a/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java b/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java index e61e3fb35..47f85faf7 100644 --- a/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java +++ b/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java @@ -347,7 +347,7 @@ public class Bootstrap { if (telnetPortPid > 0 && pid != telnetPortPid) { AnsiLog.error("Target process {} is not the process using port {}, you will connect to an unexpected process.", pid, bootstrap.getTelnetPort()); - AnsiLog.error("1. Try to restart arthas-boot, select process {}, shutdown it first with running the 'shutdown' command.", + AnsiLog.error("1. Try to restart arthas-boot, select process {}, shutdown it first with running the 'stop' command.", telnetPortPid); AnsiLog.error("2. Or try to use different telnet port, for example: java -jar arthas-boot.jar --telnet-port 9998 --http-port -1"); System.exit(1); @@ -356,7 +356,7 @@ public class Bootstrap { if (httpPortPid > 0 && pid != httpPortPid) { AnsiLog.error("Target process {} is not the process using port {}, you will connect to an unexpected process.", pid, bootstrap.getHttpPort()); - AnsiLog.error("1. Try to restart arthas-boot, select process {}, shutdown it first with running the 'shutdown' command.", + AnsiLog.error("1. Try to restart arthas-boot, select process {}, shutdown it first with running the 'stop' command.", httpPortPid); AnsiLog.error("2. Or try to use different http port, for example: java -jar arthas-boot.jar --telnet-port 9998 --http-port 9999", httpPortPid); System.exit(1); diff --git a/core/src/main/java/com/taobao/arthas/core/command/basic1000/GrepCommand.java b/core/src/main/java/com/taobao/arthas/core/command/basic1000/GrepCommand.java index 83c31b4d4..c2929d7ae 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/basic1000/GrepCommand.java +++ b/core/src/main/java/com/taobao/arthas/core/command/basic1000/GrepCommand.java @@ -10,6 +10,8 @@ import com.taobao.middleware.cli.annotations.Name; import com.taobao.middleware.cli.annotations.Option; import com.taobao.middleware.cli.annotations.Summary; +import one.profiler.AsyncProfiler; + /** * @see com.taobao.arthas.core.shell.command.internal.GrepHandler */ @@ -169,6 +171,10 @@ public class GrepCommand extends AnnotatedCommand { @Override public void process(CommandProcess process) { process.write("The grep command only for pipes. See 'grep --help'").write("\n"); + + String libPath = "/private/tmp/async-profiler-1.6-macos-x64/build/libasyncProfiler.so"; + AsyncProfiler instance = AsyncProfiler.getInstance(libPath); + process.write(instance.toString()); process.end(); } } diff --git a/site/src/site/sphinx/advanced-use.md b/site/src/site/sphinx/advanced-use.md index b79ee359a..c69873814 100644 --- a/site/src/site/sphinx/advanced-use.md +++ b/site/src/site/sphinx/advanced-use.md @@ -14,7 +14,7 @@ * version——输出当前目标 Java 进程所加载的 Arthas 版本号 * history——打印命令历史 * quit——退出当前 Arthas 客户端,其他 Arthas 客户端不受影响 -* shutdown——关闭 Arthas 服务端,所有 Arthas 客户端全部退出 +* stop/shutdown——关闭 Arthas 服务端,所有 Arthas 客户端全部退出 * [keymap](keymap.md)——Arthas快捷键列表及自定义快捷键 ## jvm相关 diff --git a/site/src/site/sphinx/commands.md b/site/src/site/sphinx/commands.md index 918b451a5..c716689c4 100644 --- a/site/src/site/sphinx/commands.md +++ b/site/src/site/sphinx/commands.md @@ -43,6 +43,6 @@ * version——输出当前目标 Java 进程所加载的 Arthas 版本号 * history——打印命令历史 * quit——退出当前 Arthas 客户端,其他 Arthas 客户端不受影响 -* stop——和`shutdown`命令一致 +* stop——和`shutdown`命令一致(推荐使用,避免误操作) * shutdown——关闭 Arthas 服务端,所有 Arthas 客户端全部退出 * [keymap](keymap.md)——Arthas快捷键列表及自定义快捷键 \ No newline at end of file diff --git a/site/src/site/sphinx/en/advanced-use.md b/site/src/site/sphinx/en/advanced-use.md index 5c6d403da..59c04bbfd 100644 --- a/site/src/site/sphinx/en/advanced-use.md +++ b/site/src/site/sphinx/en/advanced-use.md @@ -9,11 +9,11 @@ Advanced Usage * [grep]](grep.md) - Pattern searcher * [pwd](pwd.md) - Return working directory name * session - display current session information -* [reset](reset.md) - reset all the enhanced classes. All enhanced classes will also be reset when Arthas server is closed by `shutdown` +* [reset](reset.md) - reset all the enhanced classes. All enhanced classes will also be reset when Arthas server is closed by `stop/shutdown` * version - print the version for the Arthas attached to the current Java process * history - view command history * quit/exit - exit the current Arthas session, without effecting other sessions -* shutdown - terminate the Arthas server, all Arthas sessions will be destroyed +* stop/shutdown - terminate the Arthas server, all Arthas sessions will be destroyed * [keymap](keymap.md) - keymap for Arthas keyboard shortcut ## JVM @@ -42,7 +42,7 @@ Advanced Usage ## monitor/watch/trace - related -> **Attention**: commands here are taking advantage of byte-code-injection, which means we are injecting some [aspects](https://en.wikipedia.org/wiki/Aspect-oriented_programming) into the current classes for monitoring and statistics purpose. Therefore when use it for online troubleshooting in your production environment, you'd better **explicitly specify** classes/methods/criteria, and remember to remove the injected code by `shutdown` or `reset`. +> **Attention**: commands here are taking advantage of byte-code-injection, which means we are injecting some [aspects](https://en.wikipedia.org/wiki/Aspect-oriented_programming) into the current classes for monitoring and statistics purpose. Therefore when use it for online troubleshooting in your production environment, you'd better **explicitly specify** classes/methods/criteria, and remember to remove the injected code by `stop` or `reset`. * [monitor](monitor.md) - monitor method execution statistics * [watch](watch.md) - display the input/output parameter, return object, and thrown exception of specified method invocation diff --git a/site/src/site/sphinx/en/manual-install.md b/site/src/site/sphinx/en/manual-install.md index 0812988ba..3ea3dfb63 100644 --- a/site/src/site/sphinx/en/manual-install.md +++ b/site/src/site/sphinx/en/manual-install.md @@ -28,7 +28,7 @@ Manually Install Arthas 4. Start Arthas - Make sure `shutdown` the old Arthas server before start. + Make sure `stop` the old Arthas server before start. ```bash ./as.sh diff --git a/site/src/site/sphinx/en/quick-start.md b/site/src/site/sphinx/en/quick-start.md index b861e2524..fa68cbe03 100644 --- a/site/src/site/sphinx/en/quick-start.md +++ b/site/src/site/sphinx/en/quick-start.md @@ -229,4 +229,4 @@ Pls. refer to [advanced usages](advanced-use.md) for more information. Use `quit` or `exit` to disconnect from the current process. The Arthas instance attached to the target process continues to live inside the process, and its port is standby for further connection. -Use `shutdown` to have Arthas completely quit from the target process. +Use `stop` command to have Arthas completely quit from the target process. diff --git a/site/src/site/sphinx/en/reset.md b/site/src/site/sphinx/en/reset.md index cd24fbf92..ebdec1b03 100644 --- a/site/src/site/sphinx/en/reset.md +++ b/site/src/site/sphinx/en/reset.md @@ -1,7 +1,7 @@ reset === -> Reset all classes that have been enhanced by Arthas. These enhanced classes will also be reset when Arthas server is `shutdown`. +> Reset all classes that have been enhanced by Arthas. These enhanced classes will also be reset when Arthas server is `stop/shutdown`. ### Usage diff --git a/site/src/site/sphinx/manual-install.md b/site/src/site/sphinx/manual-install.md index c7c6a1029..0aac2a1e9 100644 --- a/site/src/site/sphinx/manual-install.md +++ b/site/src/site/sphinx/manual-install.md @@ -33,7 +33,7 @@ 4. 启动Arthas - 启动之前,请确保老版本的Arthas已经`shutdown`. + 启动之前,请确保老版本的Arthas已经`stop`. ``` ./as.sh diff --git a/site/src/site/sphinx/quick-start.md b/site/src/site/sphinx/quick-start.md index 514746872..b17a751c8 100644 --- a/site/src/site/sphinx/quick-start.md +++ b/site/src/site/sphinx/quick-start.md @@ -230,4 +230,4 @@ ts=2018-11-28 19:22:35; [cost=29.969732ms] result=@ArrayList[ 如果只是退出当前的连接,可以用`quit`或者`exit`命令。Attach到目标进程上的arthas还会继续运行,端口会保持开放,下次连接时可以直接连接上。 -如果想完全退出arthas,可以执行`shutdown`命令。 +如果想完全退出arthas,可以执行`stop/shutdown`命令。 diff --git a/site/src/site/sphinx/reset.md b/site/src/site/sphinx/reset.md index ecdd1cbcc..9435aa459 100644 --- a/site/src/site/sphinx/reset.md +++ b/site/src/site/sphinx/reset.md @@ -1,7 +1,7 @@ reset命令 === -> 重置增强类,将被 Arthas 增强过的类全部还原,Arthas 服务端`shutdown`时会重置所有增强过的类 +> 重置增强类,将被 Arthas 增强过的类全部还原,Arthas 服务端`stop/shutdown`时会重置所有增强过的类 ### 使用参考