mirror of
https://gitee.com/arthas/arthas.git
synced 2024-11-30 03:07:37 +08:00
rename ExpressFactory.newExpress to ExpressFactory.threadLocalExpress
This commit is contained in:
parent
734e5b547e
commit
3442f3d95c
@ -202,11 +202,11 @@ public abstract class ReflectAdviceListenerAdapter implements AdviceListener {
|
|||||||
*/
|
*/
|
||||||
protected boolean isConditionMet(String conditionExpress, Advice advice, double cost) throws ExpressException {
|
protected boolean isConditionMet(String conditionExpress, Advice advice, double cost) throws ExpressException {
|
||||||
return StringUtils.isEmpty(conditionExpress) ||
|
return StringUtils.isEmpty(conditionExpress) ||
|
||||||
ExpressFactory.newExpress(advice).bind(Constants.COST_VARIABLE, cost).is(conditionExpress);
|
ExpressFactory.threadLocalExpress(advice).bind(Constants.COST_VARIABLE, cost).is(conditionExpress);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Object getExpressionResult(String express, Advice advice, double cost) throws ExpressException {
|
protected Object getExpressionResult(String express, Advice advice, double cost) throws ExpressException {
|
||||||
return ExpressFactory.newExpress(advice)
|
return ExpressFactory.threadLocalExpress(advice)
|
||||||
.bind(Constants.COST_VARIABLE, cost).get(express);
|
.bind(Constants.COST_VARIABLE, cost).get(express);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package com.taobao.arthas.core.command.express;
|
package com.taobao.arthas.core.command.express;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表达式工厂类
|
* ExpressFactory
|
||||||
* @author ralf0131 2017-01-04 14:40.
|
* @author ralf0131 2017-01-04 14:40.
|
||||||
|
* @author hengyunabc 2018-10-08
|
||||||
*/
|
*/
|
||||||
public class ExpressFactory {
|
public class ExpressFactory {
|
||||||
|
|
||||||
@ -14,12 +15,11 @@ public class ExpressFactory {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造表达式执行类
|
* get ThreadLocal Express Object
|
||||||
*
|
* @param object
|
||||||
* @param object 执行对象
|
* @return
|
||||||
* @return 返回表达式实现
|
|
||||||
*/
|
*/
|
||||||
public static Express newExpress(Object object) {
|
public static Express threadLocalExpress(Object object) {
|
||||||
return expressRef.get().reset().bind(object);
|
return expressRef.get().reset().bind(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ public class GetStaticCommand extends AnnotatedCommand {
|
|||||||
Object value = field.get(null);
|
Object value = field.get(null);
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(express)) {
|
if (!StringUtils.isEmpty(express)) {
|
||||||
value = ExpressFactory.newExpress(value).get(express);
|
value = ExpressFactory.threadLocalExpress(value).get(express);
|
||||||
}
|
}
|
||||||
|
|
||||||
String result = StringUtils.objectToString(expand >= 0 ? new ObjectView(value, expand).draw() : value);
|
String result = StringUtils.objectToString(expand >= 0 ? new ObjectView(value, expand).draw() : value);
|
||||||
|
@ -332,7 +332,7 @@ public class TimeTunnelCommand extends EnhancerCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Advice advice = tf.getAdvice();
|
Advice advice = tf.getAdvice();
|
||||||
Object value = ExpressFactory.newExpress(advice).get(watchExpress);
|
Object value = ExpressFactory.threadLocalExpress(advice).get(watchExpress);
|
||||||
if (isNeedExpand()) {
|
if (isNeedExpand()) {
|
||||||
process.write(new ObjectView(value, expand, sizeLimit).draw()).write("\n");
|
process.write(new ObjectView(value, expand, sizeLimit).draw()).write("\n");
|
||||||
} else {
|
} else {
|
||||||
@ -361,7 +361,7 @@ public class TimeTunnelCommand extends EnhancerCommand {
|
|||||||
Advice advice = tf.getAdvice();
|
Advice advice = tf.getAdvice();
|
||||||
|
|
||||||
// 搜索出匹配的时间片段
|
// 搜索出匹配的时间片段
|
||||||
if ((ExpressFactory.newExpress(advice)).is(searchExpress)) {
|
if ((ExpressFactory.threadLocalExpress(advice)).is(searchExpress)) {
|
||||||
matchingTimeSegmentMap.put(index, tf);
|
matchingTimeSegmentMap.put(index, tf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ public class TimeTunnelTable {
|
|||||||
String watchExpress, boolean isNeedExpand, int expandLevel, int sizeLimit)
|
String watchExpress, boolean isNeedExpand, int expandLevel, int sizeLimit)
|
||||||
throws ExpressException {
|
throws ExpressException {
|
||||||
for (Map.Entry<Integer, TimeFragment> entry : matchingTimeSegmentMap.entrySet()) {
|
for (Map.Entry<Integer, TimeFragment> entry : matchingTimeSegmentMap.entrySet()) {
|
||||||
Object value = ExpressFactory.newExpress(entry.getValue().getAdvice()).get(watchExpress);
|
Object value = ExpressFactory.threadLocalExpress(entry.getValue().getAdvice()).get(watchExpress);
|
||||||
table.row("" + entry.getKey(), "" +
|
table.row("" + entry.getKey(), "" +
|
||||||
(isNeedExpand ? new ObjectView(value, expandLevel, sizeLimit).draw() : StringUtils.objectToString(value)));
|
(isNeedExpand ? new ObjectView(value, expandLevel, sizeLimit).draw() : StringUtils.objectToString(value)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user