Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
killuaz丶x
SkyWalking
提交
4f606cab
S
SkyWalking
项目概览
killuaz丶x
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
1
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,发现更多精彩内容 >>
提交
4f606cab
编写于
3月 15, 2016
作者:
wu-sheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
重命名部分类名,规范化接口参数。#36
上级
03e006bf
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
52 addition
and
13 deletion
+52
-13
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/ClassConstructorInterceptor.java
...lking/plugin/interceptor/ClassConstructorInterceptor.java
+1
-1
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/ClassMethodInterceptor.java
...skywalking/plugin/interceptor/ClassMethodInterceptor.java
+1
-1
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/ConstructorInvokeContext.java
...ywalking/plugin/interceptor/ConstructorInvokeContext.java
+25
-0
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/IAroundInterceptor.java
...oud/skywalking/plugin/interceptor/IAroundInterceptor.java
+3
-3
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/MethodInvokeContext.java
...ud/skywalking/plugin/interceptor/MethodInvokeContext.java
+17
-3
skywalking-api/src/test/java/test/ai/cloud/plugin/TestAroundInterceptor.java
...test/java/test/ai/cloud/plugin/TestAroundInterceptor.java
+5
-5
未找到文件。
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/ClassConstructorInterceptor.java
浏览文件 @
4f606cab
...
...
@@ -26,7 +26,7 @@ public class ClassConstructorInterceptor {
try
{
EnhancedClassInstanceContext
context
=
new
EnhancedClassInstanceContext
();
accessor
.
setValue
(
context
);
Constructor
Context
interceptorContext
=
new
ConstructorContext
(
Constructor
InvokeContext
interceptorContext
=
new
ConstructorInvokeContext
(
obj
,
allArguments
);
interceptor
.
onConstruct
(
context
,
interceptorContext
);
}
catch
(
Throwable
t
)
{
...
...
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/ClassMethodInterceptor.java
浏览文件 @
4f606cab
...
...
@@ -37,7 +37,7 @@ public class ClassMethodInterceptor {
@SuperCall
Callable
<?>
zuper
,
@FieldValue
(
EnhanceClazz4Interceptor
.
contextAttrName
)
EnhancedClassInstanceContext
instanceContext
)
throws
Exception
{
InterceptorContext
interceptorContext
=
new
Interceptor
Context
(
obj
,
MethodInvokeContext
interceptorContext
=
new
MethodInvoke
Context
(
obj
,
method
.
getName
(),
allArguments
);
try
{
interceptor
.
beforeMethod
(
instanceContext
,
interceptorContext
);
...
...
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/ConstructorContext.java
→
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/Constructor
Invoke
Context.java
浏览文件 @
4f606cab
package
com.ai.cloud.skywalking.plugin.interceptor
;
public
class
ConstructorContext
{
public
class
ConstructorInvokeContext
{
/**
* 代理对象实例
*/
private
Object
objInst
;
/**
* 构造函数参数
*/
private
Object
[]
allArguments
;
ConstructorContext
(
Object
[]
allArguments
)
{
ConstructorInvokeContext
(
Object
objInst
,
Object
[]
allArguments
)
{
this
.
objInst
=
objInst
;
this
.
allArguments
=
allArguments
;
}
public
Object
inst
(){
return
objInst
;
}
public
Object
[]
allArguments
(){
return
this
.
allArguments
;
}
...
...
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/IAroundInterceptor.java
浏览文件 @
4f606cab
package
com.ai.cloud.skywalking.plugin.interceptor
;
public
interface
IAroundInterceptor
{
public
void
onConstruct
(
EnhancedClassInstanceContext
context
,
ConstructorContext
interceptorContext
);
public
void
onConstruct
(
EnhancedClassInstanceContext
context
,
Constructor
Invoke
Context
interceptorContext
);
public
void
beforeMethod
(
EnhancedClassInstanceContext
context
,
Interceptor
Context
interceptorContext
);
public
void
beforeMethod
(
EnhancedClassInstanceContext
context
,
MethodInvoke
Context
interceptorContext
);
public
Object
afterMethod
(
EnhancedClassInstanceContext
context
,
Interceptor
Context
interceptorContext
,
Object
ret
);
public
Object
afterMethod
(
EnhancedClassInstanceContext
context
,
MethodInvoke
Context
interceptorContext
,
Object
ret
);
}
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/
Interceptor
Context.java
→
skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/
MethodInvoke
Context.java
浏览文件 @
4f606cab
package
com.ai.cloud.skywalking.plugin.interceptor
;
public
class
InterceptorContext
{
/**
* 方法执行拦截上下文
*
* @author wusheng
*
*/
public
class
MethodInvokeContext
{
/**
* 代理类实例
*/
private
Object
objInst
;
/**
* 方法名称
*/
private
String
methodName
;
/**
* 方法参数
*/
private
Object
[]
allArguments
;
Interceptor
Context
(
Object
objInst
,
String
methodName
,
Object
[]
allArguments
)
{
MethodInvoke
Context
(
Object
objInst
,
String
methodName
,
Object
[]
allArguments
)
{
this
.
objInst
=
objInst
;
this
.
methodName
=
methodName
;
this
.
allArguments
=
allArguments
;
...
...
skywalking-api/src/test/java/test/ai/cloud/plugin/TestAroundInterceptor.java
浏览文件 @
4f606cab
package
test.ai.cloud.plugin
;
import
com.ai.cloud.skywalking.plugin.interceptor.ConstructorContext
;
import
com.ai.cloud.skywalking.plugin.interceptor.Constructor
Invoke
Context
;
import
com.ai.cloud.skywalking.plugin.interceptor.EnhancedClassInstanceContext
;
import
com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor
;
import
com.ai.cloud.skywalking.plugin.interceptor.
Interceptor
Context
;
import
com.ai.cloud.skywalking.plugin.interceptor.
MethodInvoke
Context
;
public
class
TestAroundInterceptor
implements
IAroundInterceptor
{
@Override
public
void
onConstruct
(
EnhancedClassInstanceContext
context
,
ConstructorContext
interceptorContext
)
{
public
void
onConstruct
(
EnhancedClassInstanceContext
context
,
Constructor
Invoke
Context
interceptorContext
)
{
context
.
set
(
"test.key"
,
"123"
);
System
.
out
.
println
(
"onConstruct, args size="
+
interceptorContext
.
allArguments
().
length
);
}
@Override
public
void
beforeMethod
(
EnhancedClassInstanceContext
context
,
Interceptor
Context
interceptorContext
)
{
public
void
beforeMethod
(
EnhancedClassInstanceContext
context
,
MethodInvoke
Context
interceptorContext
)
{
System
.
out
.
println
(
"beforeMethod : "
+
context
.
get
(
"test.key"
,
String
.
class
));
}
@Override
public
Object
afterMethod
(
EnhancedClassInstanceContext
context
,
Interceptor
Context
interceptorContext
,
Object
ret
)
{
public
Object
afterMethod
(
EnhancedClassInstanceContext
context
,
MethodInvoke
Context
interceptorContext
,
Object
ret
)
{
System
.
out
.
println
(
"afterMethod: "
+
context
.
get
(
"test.key"
,
String
.
class
));
return
ret
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录