Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
SkyWalking
提交
ed487bc2
S
SkyWalking
项目概览
apache
/
SkyWalking
上一次同步 1 年多
通知
302
Star
21345
Fork
6091
代码
文件
提交
分支
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,体验更适合开发者的 AI 搜索 >>
提交
ed487bc2
编写于
5月 04, 2018
作者:
L
lican
提交者:
wu-sheng
5月 04, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add RunnableWrapper (#1152)
* Add RunnableWrapper * movement * Fix Location
上级
42eaa1f2
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
83 addition
and
105 deletion
+83
-105
apm-application-toolkit/apm-toolkit-trace/src/main/java/org/apache/skywalking/apm/toolkit/trace/RunnableWrapper.java
.../apache/skywalking/apm/toolkit/trace/RunnableWrapper.java
+39
-0
apm-sniffer/apm-sdk-plugin/jdk-cross-thread-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/jdk-cross-thread-plugin/pom.xml
+0
-59
apm-sniffer/apm-sdk-plugin/jdk-cross-thread-plugin/src/main/resources/skywalking-plugin.def
...ss-thread-plugin/src/main/resources/skywalking-plugin.def
+0
-17
apm-sniffer/apm-sdk-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/pom.xml
+0
-1
apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-activation/src/main/java/org/apache/skywalking/apm/toolkit/activation/trace/CallableOrRunnableActivation.java
...oolkit/activation/trace/CallableOrRunnableActivation.java
+7
-10
apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-activation/src/main/java/org/apache/skywalking/apm/toolkit/activation/trace/CallableOrRunnableConstructInterceptor.java
...ivation/trace/CallableOrRunnableConstructInterceptor.java
+1
-2
apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-activation/src/main/java/org/apache/skywalking/apm/toolkit/activation/trace/CallableOrRunnableInvokeInterceptor.java
...activation/trace/CallableOrRunnableInvokeInterceptor.java
+3
-3
apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-activation/src/main/resources/skywalking-plugin.def
...trace-activation/src/main/resources/skywalking-plugin.def
+1
-0
apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-activation/src/test/java/org/apache/skywalking/apm/toolkit/activation/trace/CallableOrRunnableInterceptorTest.java
...t/activation/trace/CallableOrRunnableInterceptorTest.java
+13
-13
docs/cn/Application-toolkit-trace-cross-thread-CN.md
docs/cn/Application-toolkit-trace-cross-thread-CN.md
+9
-0
docs/en/Application-toolkit-trace-cross-thread.md
docs/en/Application-toolkit-trace-cross-thread.md
+10
-0
未找到文件。
apm-application-toolkit/apm-toolkit-trace/src/main/java/org/apache/skywalking/apm/toolkit/trace/RunnableWrapper.java
0 → 100644
浏览文件 @
ed487bc2
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.skywalking.apm.toolkit.trace
;
/**
* @author lican
*/
@TraceCrossThread
public
class
RunnableWrapper
implements
Runnable
{
final
Runnable
runnable
;
public
RunnableWrapper
(
Runnable
runnable
)
{
this
.
runnable
=
runnable
;
}
public
static
RunnableWrapper
of
(
Runnable
r
)
{
return
new
RunnableWrapper
(
r
);
}
@Override
public
void
run
()
{
this
.
runnable
.
run
();
}
}
\ No newline at end of file
apm-sniffer/apm-sdk-plugin/jdk-cross-thread-plugin/pom.xml
已删除
100644 → 0
浏览文件 @
42eaa1f2
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2017, OpenSkywalking Organization All rights reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
~ Project repository: https://github.com/OpenSkywalking/skywalking
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
apm-sdk-plugin
</artifactId>
<groupId>
org.apache.skywalking
</groupId>
<version>
5.0.0-beta-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apm-jdk-cross-thread-plugin
</artifactId>
<name>
jdk-cross-thread-plugin
</name>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-deploy-plugin
</artifactId>
</plugin>
<plugin>
<!-- 源码插件 -->
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-source-plugin
</artifactId>
<!-- 发布时自动将源码同时发布的配置 -->
<executions>
<execution>
<id>
attach-sources
</id>
<goals>
<goal>
jar
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
apm-sniffer/apm-sdk-plugin/jdk-cross-thread-plugin/src/main/resources/skywalking-plugin.def
已删除
100644 → 0
浏览文件 @
42eaa1f2
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
jdk-cross-thread=org.apache.skywalking.apm.plugin.jdk.thread.define.CallableOrRunnableInstrumentation
apm-sniffer/apm-sdk-plugin/pom.xml
浏览文件 @
ed487bc2
...
...
@@ -56,7 +56,6 @@
<module>
kafka-v1-plugin
</module>
<module>
servicecomb-plugin
</module>
<module>
hystrix-1.x-plugin
</module>
<module>
jdk-cross-thread-plugin
</module>
</modules>
<packaging>
pom
</packaging>
...
...
apm-sniffer/apm-
sdk-plugin/jdk-cross-thread-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/thread/define/CallableOrRunnableInstrument
ation.java
→
apm-sniffer/apm-
toolkit-activation/apm-toolkit-trace-activation/src/main/java/org/apache/skywalking/apm/toolkit/activation/trace/CallableOrRunnableActiv
ation.java
浏览文件 @
ed487bc2
...
...
@@ -13,10 +13,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org.apache.skywalking.apm.
plugin.jdk.thread.defin
e
;
package
org.apache.skywalking.apm.
toolkit.activation.trac
e
;
import
net.bytebuddy.description.method.MethodDescription
;
import
net.bytebuddy.matcher.ElementMatcher
;
...
...
@@ -25,22 +24,20 @@ import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsIn
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine
;
import
org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
any
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
named
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.
takesArguments
;
import
static
net
.
bytebuddy
.
matcher
.
ElementMatchers
.*;
import
static
org
.
apache
.
skywalking
.
apm
.
agent
.
core
.
plugin
.
match
.
ClassAnnotationMatch
.
byClassAnnotationMatch
;
/**
* {@link CallableOrRunnable
Instrument
ation} presents that skywalking intercepts all Class with annotation
* {@link CallableOrRunnable
Activ
ation} presents that skywalking intercepts all Class with annotation
* "org.skywalking.apm.toolkit.trace.TraceCrossThread" and method named "call" or "run".
*
* @author carlvine500
* @author carlvine500
lican
*/
public
class
CallableOrRunnable
Instrument
ation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
class
CallableOrRunnable
Activ
ation
extends
ClassInstanceMethodsEnhancePluginDefine
{
public
static
final
String
ANNOTATION_NAME
=
"org.apache.skywalking.apm.toolkit.trace.TraceCrossThread"
;
private
static
final
String
INIT_METHOD_INTERCEPTOR
=
"org.apache.skywalking.apm.
plugin.jdk.thread
.CallableOrRunnableConstructInterceptor"
;
private
static
final
String
CALL_METHOD_INTERCEPTOR
=
"org.apache.skywalking.apm.
plugin.jdk.thread
.CallableOrRunnableInvokeInterceptor"
;
private
static
final
String
INIT_METHOD_INTERCEPTOR
=
"org.apache.skywalking.apm.
toolkit.activation.trace
.CallableOrRunnableConstructInterceptor"
;
private
static
final
String
CALL_METHOD_INTERCEPTOR
=
"org.apache.skywalking.apm.
toolkit.activation.trace
.CallableOrRunnableInvokeInterceptor"
;
private
static
final
String
CALL_METHOD_NAME
=
"call"
;
private
static
final
String
RUN_METHOD_NAME
=
"run"
;
...
...
apm-sniffer/apm-
sdk-plugin/jdk-cross-thread-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/thread
/CallableOrRunnableConstructInterceptor.java
→
apm-sniffer/apm-
toolkit-activation/apm-toolkit-trace-activation/src/main/java/org/apache/skywalking/apm/toolkit/activation/trace
/CallableOrRunnableConstructInterceptor.java
浏览文件 @
ed487bc2
...
...
@@ -13,9 +13,8 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org.apache.skywalking.apm.
plugin.jdk.thread
;
package
org.apache.skywalking.apm.
toolkit.activation.trace
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
...
...
apm-sniffer/apm-
sdk-plugin/jdk-cross-thread-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdk/thread
/CallableOrRunnableInvokeInterceptor.java
→
apm-sniffer/apm-
toolkit-activation/apm-toolkit-trace-activation/src/main/java/org/apache/skywalking/apm/toolkit/activation/trace
/CallableOrRunnableInvokeInterceptor.java
浏览文件 @
ed487bc2
...
...
@@ -13,17 +13,17 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org.apache.skywalking.apm.
plugin.jdk.thread
;
package
org.apache.skywalking.apm.
toolkit.activation.trace
;
import
java.lang.reflect.Method
;
import
org.apache.skywalking.apm.agent.core.context.ContextManager
;
import
org.apache.skywalking.apm.agent.core.context.ContextSnapshot
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor
;
import
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult
;
import
java.lang.reflect.Method
;
/**
* @author carlvine500
*/
...
...
apm-sniffer/apm-toolkit-activation/apm-toolkit-trace-activation/src/main/resources/skywalking-plugin.def
浏览文件 @
ed487bc2
...
...
@@ -17,3 +17,4 @@
toolkit-trace=org.apache.skywalking.apm.toolkit.activation.trace.ActiveSpanTagActivation
toolkit-trace=org.apache.skywalking.apm.toolkit.activation.trace.TraceAnnotationActivation
toolkit-trace=org.apache.skywalking.apm.toolkit.activation.trace.TraceContextActivation
toolkit-trace=org.apache.skywalking.apm.toolkit.activation.trace.CallableOrRunnableActivation
apm-sniffer/apm-
sdk-plugin/jdk-cross-thread-plugin/src/test/java/org/apache/skywalking/apm/plugin/jdk/thread
/CallableOrRunnableInterceptorTest.java
→
apm-sniffer/apm-
toolkit-activation/apm-toolkit-trace-activation/src/test/java/org/apache/skywalking/apm/toolkit/activation/trace
/CallableOrRunnableInterceptorTest.java
浏览文件 @
ed487bc2
...
...
@@ -13,22 +13,10 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org.apache.skywalking.apm.
plugin.jdk.thread
;
package
org.apache.skywalking.apm.
toolkit.activation.trace
;
import
java.lang.reflect.Method
;
import
java.util.List
;
import
java.util.concurrent.Callable
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.Mock
;
import
org.powermock.modules.junit4.PowerMockRunner
;
import
org.powermock.modules.junit4.PowerMockRunnerDelegate
;
import
org.apache.skywalking.apm.agent.core.context.ContextSnapshot
;
import
org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan
;
import
org.apache.skywalking.apm.agent.core.context.trace.TraceSegment
;
...
...
@@ -38,6 +26,18 @@ import org.apache.skywalking.apm.agent.test.tools.AgentServiceRule;
import
org.apache.skywalking.apm.agent.test.tools.SegmentStorage
;
import
org.apache.skywalking.apm.agent.test.tools.SegmentStoragePoint
;
import
org.apache.skywalking.apm.agent.test.tools.TracingSegmentRunner
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.Mock
;
import
org.powermock.modules.junit4.PowerMockRunner
;
import
org.powermock.modules.junit4.PowerMockRunnerDelegate
;
import
java.lang.reflect.Method
;
import
java.util.List
;
import
java.util.concurrent.Callable
;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertThat
;
...
...
docs/cn/Application-toolkit-trace-cross-thread-CN.md
浏览文件 @
ed487bc2
...
...
@@ -30,6 +30,15 @@
}
}));
```
或者
```
java
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
1
);
executorService
.
execute
(
RunnableWrapper
.
of
(
new
Runnable
()
{
@Override
public
void
run
()
{
//your code
}
}));
```
_示例代码,仅供参考_
...
...
docs/en/Application-toolkit-trace-cross-thread.md
浏览文件 @
ed487bc2
...
...
@@ -30,6 +30,16 @@
}
}));
```
or
```
java
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
1
);
executorService
.
execute
(
RunnableWrapper
.
of
(
new
Runnable
()
{
@Override
public
void
run
()
{
//your code
}
}));
```
_Sample codes only_
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录