官网:https://arthas.aliyun.com/
github:https://github.com/alibaba/arthas
Arthas 是一款线上监控诊断产品,通过全局视角实时查看应用 load、内存、gc、线程的状态信息,并能在不修改应用代码的情况下,对业务问题进行诊断,包括查看方法调用的出入参、异常,监测方法执行耗时,类加载信息等,大大提升线上问题排查效率。
[arthas@70070]$ echo 'abc' > /tmp/test.txt
[arthas@70070]$ cat /tmp/test.txt
abc
[arthas@70070]$ base64 /tmp/test.txt
YWJjCg==
[arthas@19836]$ session
Name Value
--------------------------------------------------
JAVA_PID 19836
SESSION_ID d864f3f9-a139-473d-951c-0fa8039ea901
ognl '@[email protected]("wangzijian")'
[arthas@19836]$ ognl '@demo.MathGame@random'
@Random[
serialVersionUID=@Long[3905348978240129619],
seed=@AtomicLong[7988179685469],
multiplier=@Long[25214903917],
addend=@Long[11],
mask=@Long[281474976710655],
DOUBLE_UNIT=@Double[1.1102230246251565E-16],
BadBound=@String[bound must be positive],
BadRange=@String[bound must be greater than origin],
BadSize=@String[size must be non-negative],
seedUniquifier=@AtomicLong[199880078823418412],
nextNextGaussian=@Double[0.0],
haveNextNextGaussian=@Boolean[false],
serialPersistentFields=@ObjectStreamField[][isEmpty=false;size=3],
unsafe=@Unsafe[sun.misc.Unsafe@64911ac2],
seedOffset=@Long[24],
]
[arthas@19836]$ sc demo.MathGame -d
class-info demo.MathGame
code-source /D:/arthas/math-game.jar
name demo.MathGame
isInterface false
isAnnotation false
isEnum false
isAnonymousClass false
isArray false
isLocalClass false
isMemberClass false
isPrimitive false
isSynthetic false
simple-name MathGame
modifier public
annotation
interfaces
super-class +-java.lang.Object
class-loader +-sun.misc.Launcher$AppClassLoader@5c647e05
+-sun.misc.Launcher$ExtClassLoader@28d93b30
classLoaderHash 5c647e05
[arthas@19836]$ sm java.lang.Integer
java.lang.Integer <init>(I)V
java.lang.Integer <init>(Ljava/lang/String;)V
java.lang.Integer numberOfLeadingZeros(I)I
java.lang.Integer numberOfTrailingZeros(I)I
java.lang.Integer bitCount(I)I
java.lang.Integer equals(Ljava/lang/Object;)Z
java.lang.Integer toString(II)Ljava/lang/String;
java.lang.Integer toString()Ljava/lang/String;
java.lang.Integer toString(I)Ljava/lang/String;
java.lang.Integer hashCode(I)I
java.lang.Integer hashCode()I
java.lang.Integer min(II)I
java.lang.Integer max(II)I
[arthas@19836]$ jad demo.MathGame print
ClassLoader:
+-sun.misc.Launcher$AppClassLoader@5c647e05
+-sun.misc.Launcher$ExtClassLoader@28d93b30
Location:
/D:/arthas/math-game.jar
public static void print(int number, List<Integer> primeFactors) {
StringBuffer sb = new StringBuffer(number + "=");
/*34*/ for (int factor : primeFactors) {
/*35*/ sb.append(factor).append('*');
}
/*37*/ if (sb.charAt(sb.length() - 1) == '*') {
/*38*/ sb.deleteCharAt(sb.length() - 1);
}
/*40*/ System.out.println(sb);
}
Affect(row-cnt:1) cost in 97 ms.
.java
文件为.class
文件.class
文件,redefine 到 JVM 里❗.class
文件,retransform 到 JVM 里http://zjyun.cc/wordpress/2809435016662