Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
润土的好友猹
SkyWalking
提交
a1f4e82f
S
SkyWalking
项目概览
润土的好友猹
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a1f4e82f
编写于
1月 04, 2017
作者:
wu-sheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add comments on the two new match. #78
上级
c0cb0c85
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
41 addition
and
4 deletion
+41
-4
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/bytebuddy/AllObjectDefaultMethodsMatch.java
...alking/plugin/bytebuddy/AllObjectDefaultMethodsMatch.java
+12
-3
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/bytebuddy/ArgumentTypeNameMatch.java
...ye/skywalking/plugin/bytebuddy/ArgumentTypeNameMatch.java
+29
-0
skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisPluginDefine.java
.../skywalking/plugin/jedis/v2/define/JedisPluginDefine.java
+0
-1
未找到文件。
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/bytebuddy/AllObjectDefaultMethodsMatch.java
浏览文件 @
a1f4e82f
...
...
@@ -13,9 +13,15 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
* Created by wusheng on 2017/1/3.
*/
public
enum
AllObjectDefaultMethodsMatch
implements
ElementMatcher
<
MethodDescription
>
{
/**
* Stay in singleton.
*/
INSTANCE
;
private
ElementMatcher
.
Junction
<
MethodDescription
>
matcher
;
/**
* The matcher will be init in constructor and stay permanent.
*/
private
final
ElementMatcher
.
Junction
<
MethodDescription
>
matcher
;
AllObjectDefaultMethodsMatch
()
{
ElementMatcher
.
Junction
<
MethodDescription
>[]
allDefaultMethods
=
new
ElementMatcher
.
Junction
[]
{
named
(
"finalize"
).
and
(
takesArguments
(
0
)).
and
(
ElementMatchers
.<
MethodDescription
>
isPublic
()),
...
...
@@ -30,13 +36,16 @@ public enum AllObjectDefaultMethodsMatch implements ElementMatcher<MethodDescrip
named
(
"notify"
).
and
(
takesArguments
(
0
)).
and
(
ElementMatchers
.<
MethodDescription
>
isPublic
()),
named
(
"notifyAll"
).
and
(
takesArguments
(
0
)).
and
(
ElementMatchers
.<
MethodDescription
>
isPublic
())};
ElementMatcher
.
Junction
<
MethodDescription
>
newMatcher
=
null
;
for
(
int
i
=
0
;
i
<
allDefaultMethods
.
length
;
i
++)
{
if
(
i
==
0
){
m
atcher
=
allDefaultMethods
[
i
];
newM
atcher
=
allDefaultMethods
[
i
];
}
else
{
m
atcher
.
or
(
allDefaultMethods
[
i
]);
newMatcher
=
newM
atcher
.
or
(
allDefaultMethods
[
i
]);
}
}
matcher
=
newMatcher
;
}
@Override
...
...
skywalking-sniffer/skywalking-api/src/main/java/com/a/eye/skywalking/plugin/bytebuddy/ArgumentTypeNameMatch.java
浏览文件 @
a1f4e82f
...
...
@@ -4,18 +4,39 @@ import net.bytebuddy.description.method.MethodDescription;
import
net.bytebuddy.matcher.ElementMatcher
;
/**
* Argument Type match.
* Similar with {@link net.bytebuddy.matcher.ElementMatchers#takesArgument},
* the only different between them is this match use {@link String} to declare the type, instead of {@link Class}.
* This can avoid the classloader risk.
*
* Created by wusheng on 2016/12/1.
*/
public
class
ArgumentTypeNameMatch
implements
ElementMatcher
<
MethodDescription
>
{
/**
* the index of arguments list.
*/
private
int
index
;
/**
* the target argument type at {@link ArgumentTypeNameMatch#index} of the arguments list.
*/
private
String
argumentTypeName
;
/**
* declare the match target method with the certain index and type.
* @param index the index of arguments list.
* @param argumentTypeName target argument type
*/
private
ArgumentTypeNameMatch
(
int
index
,
String
argumentTypeName
)
{
this
.
index
=
index
;
this
.
argumentTypeName
=
argumentTypeName
;
}
/**
* Match the target method.
* @param target target method description.
* @return true if matched. or false.
*/
@Override
public
boolean
matches
(
MethodDescription
target
)
{
if
(
target
.
getParameters
().
size
()
>
index
)
{
...
...
@@ -25,6 +46,14 @@ public class ArgumentTypeNameMatch implements ElementMatcher<MethodDescription>
return
false
;
}
/**
* The static method to create {@link ArgumentTypeNameMatch}
* This is a delegate method to follow byte-buddy {@link ElementMatcher<MethodDescription>}'s code style.
*
* @param index the index of arguments list.
* @param argumentTypeName target argument type
* @return new {@link ArgumentTypeNameMatch} instance.
*/
public
static
ElementMatcher
<
MethodDescription
>
takesArgumentWithType
(
int
index
,
String
argumentTypeName
){
return
new
ArgumentTypeNameMatch
(
index
,
argumentTypeName
);
}
...
...
skywalking-sniffer/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/com/a/eye/skywalking/plugin/jedis/v2/define/JedisPluginDefine.java
浏览文件 @
a1f4e82f
package
com.a.eye.skywalking.plugin.jedis.v2.define
;
import
com.a.eye.skywalking.plugin.bytebuddy.AllObjectDefaultMethodsMatch
;
import
com.a.eye.skywalking.plugin.bytebuddy.ArgumentTypeNameMatch
;
import
com.a.eye.skywalking.plugin.interceptor.ConstructorInterceptPoint
;
import
com.a.eye.skywalking.plugin.interceptor.InstanceMethodsInterceptPoint
;
import
com.a.eye.skywalking.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录