|
|
|
@ -2,12 +2,12 @@ package com.taobao.arthas.core.advisor;
|
|
|
|
|
|
|
|
|
|
import java.arthas.SpyAPI.AbstractSpy;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.arthas.deps.org.slf4j.Logger;
|
|
|
|
|
import com.alibaba.arthas.deps.org.slf4j.LoggerFactory;
|
|
|
|
|
import com.taobao.arthas.core.shell.system.ExecStatus;
|
|
|
|
|
import com.taobao.arthas.core.shell.system.ProcessAware;
|
|
|
|
|
import com.taobao.arthas.core.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <pre>
|
|
|
|
@ -27,7 +27,7 @@ public class SpyImpl extends AbstractSpy {
|
|
|
|
|
public void atEnter(Class<?> clazz, String methodInfo, Object target, Object[] args) {
|
|
|
|
|
ClassLoader classLoader = clazz.getClassLoader();
|
|
|
|
|
|
|
|
|
|
String[] info = splitMethodInfo(methodInfo);
|
|
|
|
|
String[] info = StringUtils.splitMethodInfo(methodInfo);
|
|
|
|
|
String methodName = info[0];
|
|
|
|
|
String methodDesc = info[1];
|
|
|
|
|
// TODO listener 只用查一次,放到 thread local里保存起来就可以了!
|
|
|
|
@ -52,7 +52,7 @@ public class SpyImpl extends AbstractSpy {
|
|
|
|
|
public void atExit(Class<?> clazz, String methodInfo, Object target, Object[] args, Object returnObject) {
|
|
|
|
|
ClassLoader classLoader = clazz.getClassLoader();
|
|
|
|
|
|
|
|
|
|
String[] info = splitMethodInfo(methodInfo);
|
|
|
|
|
String[] info = StringUtils.splitMethodInfo(methodInfo);
|
|
|
|
|
String methodName = info[0];
|
|
|
|
|
String methodDesc = info[1];
|
|
|
|
|
|
|
|
|
@ -76,7 +76,7 @@ public class SpyImpl extends AbstractSpy {
|
|
|
|
|
public void atExceptionExit(Class<?> clazz, String methodInfo, Object target, Object[] args, Throwable throwable) {
|
|
|
|
|
ClassLoader classLoader = clazz.getClassLoader();
|
|
|
|
|
|
|
|
|
|
String[] info = splitMethodInfo(methodInfo);
|
|
|
|
|
String[] info = StringUtils.splitMethodInfo(methodInfo);
|
|
|
|
|
String methodName = info[0];
|
|
|
|
|
String methodDesc = info[1];
|
|
|
|
|
|
|
|
|
@ -99,7 +99,7 @@ public class SpyImpl extends AbstractSpy {
|
|
|
|
|
@Override
|
|
|
|
|
public void atBeforeInvoke(Class<?> clazz, String invokeInfo, Object target) {
|
|
|
|
|
ClassLoader classLoader = clazz.getClassLoader();
|
|
|
|
|
String[] info = splitInvokeInfo(invokeInfo);
|
|
|
|
|
String[] info = StringUtils.splitInvokeInfo(invokeInfo);
|
|
|
|
|
String owner = info[0];
|
|
|
|
|
String methodName = info[1];
|
|
|
|
|
String methodDesc = info[2];
|
|
|
|
@ -125,7 +125,7 @@ public class SpyImpl extends AbstractSpy {
|
|
|
|
|
@Override
|
|
|
|
|
public void atAfterInvoke(Class<?> clazz, String invokeInfo, Object target) {
|
|
|
|
|
ClassLoader classLoader = clazz.getClassLoader();
|
|
|
|
|
String[] info = splitInvokeInfo(invokeInfo);
|
|
|
|
|
String[] info = StringUtils.splitInvokeInfo(invokeInfo);
|
|
|
|
|
String owner = info[0];
|
|
|
|
|
String methodName = info[1];
|
|
|
|
|
String methodDesc = info[2];
|
|
|
|
@ -151,7 +151,7 @@ public class SpyImpl extends AbstractSpy {
|
|
|
|
|
@Override
|
|
|
|
|
public void atInvokeException(Class<?> clazz, String invokeInfo, Object target, Throwable throwable) {
|
|
|
|
|
ClassLoader classLoader = clazz.getClassLoader();
|
|
|
|
|
String[] info = splitInvokeInfo(invokeInfo);
|
|
|
|
|
String[] info = StringUtils.splitInvokeInfo(invokeInfo);
|
|
|
|
|
String owner = info[0];
|
|
|
|
|
String methodName = info[1];
|
|
|
|
|
String methodDesc = info[2];
|
|
|
|
@ -174,15 +174,7 @@ public class SpyImpl extends AbstractSpy {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String[] splitMethodInfo(String methodInfo) {
|
|
|
|
|
return methodInfo.split(Pattern.quote("|"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String[] splitInvokeInfo(String invokeInfo) {
|
|
|
|
|
return invokeInfo.split(Pattern.quote("|"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean skipAdviceListener(AdviceListener adviceListener) {
|
|
|
|
|
private static boolean skipAdviceListener(AdviceListener adviceListener) {
|
|
|
|
|
if (adviceListener instanceof ProcessAware) {
|
|
|
|
|
ProcessAware processAware = (ProcessAware) adviceListener;
|
|
|
|
|
ExecStatus status = processAware.getProcess().status();
|
|
|
|
|