Arthas從9月份開源以來,受到廣大Java開發者的支持,Github Star數三個月超過6000,很是感謝用戶支持。同時用戶給Arthas提出了不少建議,其中反映最多的是:html
在Arthas 3.0.5版本里,咱們在用戶體驗方面作了不少改進,下面逐一介紹。java
arthas-boot
是新增長的支持全平臺的啓動器,Windows/Mac/Linux下使用體驗一致。下載後,直接java -jar
命令啓動:git
wget https://alibaba.github.io/arthas/arthas-boot.jar
java -jar arthas-boot.jar
複製代碼
arthas-boot
的功能比之前的as.sh
更強大。github
好比下載速度比較慢,能夠指定阿里雲的鏡像。web
java -jar arthas-boot.jar --repo-mirror aliyun --use-http
複製代碼
好比能夠經過session-timeout
指定超時時間:docker
java -jar arthas-boot.jar --session-timeout 3600
複製代碼
更多的功能能夠經過java -jar arthas-boot.jar -h
查看安全
arthas-boot
在attach成功以後,會啓動一個java telent client去鏈接Arthas Server,用戶沒有安裝telnet的狀況下也能夠正常使用。bash
在新版本里,默認會從arthas-boot.jar
和as.sh
所在的目錄下查找arthas home,這樣子用戶全量安裝以後,不須要再從遠程下載Arthas。session
在以前的版本里,用戶困擾最多的是,明明選擇了進程A,可是實際鏈接到的倒是進程B。maven
緣由是以前attach了進程B,沒有執行shutdown
,下次再執行時,仍是鏈接到進程B。
在新版本里,作了改進:
$ java -jar arthas-boot.jar
[INFO] Process 1680 already using port 3658
[INFO] Process 1680 already using port 8563
* [1]: 1680 Demo
[2]: 35542
[3]: 82334 Demo
3
[ERROR] Target process 82334 is not the process using port 3658, you will connect to an unexpected process.
[ERROR] If you still want to attach target process 82334, Try to set a different telnet port by using --telnet-port argument.
[ERROR] Or try to shutdown the process 1680 using the telnet port first.
複製代碼
新版本對鍵盤Up/Down
有了更好的匹配機制,試用有驚喜:)
好比執行了屢次trace,可是在命令行輸入 trace後,想不起來以前trace的具體類名,那麼按Up
,能夠很輕鬆地匹配到以前的歷史命令,不須要辛苦翻頁。
新版本增長了history
命令
改進對Windows的字體支持
以前Windows下面使用的是非等寬字體,看起來很難受。新版本里統一爲等寬字體。
增大字體,再也不傷害眼睛
sysenv命令和sysprop相似,能夠打印JVM的環境變量。
ognl命令提供了單獨執行ognl腳本的功能。能夠很方便調用各類代碼。
好比執行多行表達式,賦值給臨時變量,返回一個List:
$ ognl '#value1=@System@getProperty("java.home"), #value2=@System@getProperty("java.runtime.name"), {#value1, #value2}'
@ArrayList[
@String[/opt/java/8.0.181-zulu/jre],
@String[OpenJDK Runtime Environment],
]
複製代碼
以前watch命令只支持打印入參返回值等,新版本同時打印出調用耗時,能夠很方便定位性能瓶頸。
$ watch demo.MathGame primeFactors 'params[0]'
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in 22 ms.
ts=2018-11-29 17:53:54; [cost=0.131383ms] result=@Integer[-387929024]
ts=2018-11-29 17:53:55; [cost=0.132368ms] result=@Integer[-1318275764]
ts=2018-11-29 17:53:56; [cost=0.496598ms] result=@Integer[76446257]
ts=2018-11-29 17:53:57; [cost=4.9617ms] result=@Integer[1853966253]
複製代碼
以前的版本里,在搜索lambda類時,或者反編繹lambda類有可能會失敗。新版本作了修復。好比
$ jad Test$$Lambda$1/1406718218
ClassLoader:
+-sun.misc.Launcher$AppClassLoader@5c647e05
+-sun.misc.Launcher$ExtClassLoader@3c1491ce
Location:
/tmp/classes
/* * Decompiled with CFR 0_132. * * Could not load the following classes: * Test * Test$$Lambda$1 */
import java.lang.invoke.LambdaForm;
import java.util.function.Consumer;
final class Test$$Lambda$1 implements Consumer {
private Test$$Lambda$1() {
}
@LambdaForm.Hidden public void accept(Object object) {
Test.lambda$0((Integer)((Integer)object));
}
}
複製代碼
改進了不少命令的tab
自動補全功能,有停頓時,能夠多按tab
嘗試下。
詳細的Release Note:github.com/alibaba/art…