Critical Fields in ExpressionsΒΆ
There is a very fundamental class Advice
for the expressions used in filtering, tracing or monitoring and other aspects in commands.
public class Advice {
private final ClassLoader loader;
private final Class<?> clazz;
private final ArthasMethod method;
private final Object target;
private final Object[] params;
private final Object returnObj;
private final Throwable throwExp;
private final boolean isBefore;
private final boolean isThrow;
private final boolean isReturn;
...
// getter/setter
}
Name | Specification |
---|---|
loader | class loader of the class |
clazz | the reference of the class |
method | the reflective reference of the method |
target | the instance of the class |
params | the parameters of the method, which is an array (when there is no argument in the method, it will be an empty array) |
returnObj | the return value of the method - only when isReturn==true , it's a valid result but if the return value is void then it will be a null |
throwExp | the exceptions thrown by the method invoking - only when isThrow==true , it's a valid thrown exception |
isBefore | assistant checking flag used in before-watching point and at this very moment: isBefore==true , isThrow==false and isReturn==false since it's before we invoke the method |
isThrow | assistant checking flag: whether the current method invoking ends with exceptions |
isReturn | assistant checking flag: whether the method invoking exits normally without exceptions |
F.Y.I
- all the fields mentioned in the table above can be used directly in the
expressions
; - if the expressions are invalid OGNL, the command will be cancelled automatically with hints to correct the expressions;
- typical use cases;
- OGNL official usage guide.