Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
山不在高_有仙则灵
SkyWalking
提交
43cf0627
S
SkyWalking
项目概览
山不在高_有仙则灵
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
12
Star
0
Fork
2
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
43cf0627
编写于
10月 15, 2017
作者:
wu-sheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Finish plugin initialization codes and fix package issues.
上级
83f8714f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
127 addition
and
62 deletion
+127
-62
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/loader/AgentClassLoader.java
...alking/apm/agent/core/plugin/loader/AgentClassLoader.java
+4
-33
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/loader/InterceptorInstanceLoader.java
...m/agent/core/plugin/loader/InterceptorInstanceLoader.java
+9
-13
apm-sniffer/apm-agent/pom.xml
apm-sniffer/apm-agent/pom.xml
+0
-2
apm-sniffer/apm-sdk-plugin/pom.xml
apm-sniffer/apm-sdk-plugin/pom.xml
+47
-0
apm-sniffer/apm-toolkit-activation/pom.xml
apm-sniffer/apm-toolkit-activation/pom.xml
+65
-13
apm-sniffer/pom.xml
apm-sniffer/pom.xml
+2
-1
未找到文件。
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/loader/AgentClassLoader.java
浏览文件 @
43cf0627
...
...
@@ -34,6 +34,7 @@ import java.util.jar.JarEntry;
import
java.util.jar.JarFile
;
import
org.skywalking.apm.agent.core.boot.AgentPackageNotFoundException
;
import
org.skywalking.apm.agent.core.boot.AgentPackagePath
;
import
org.skywalking.apm.agent.core.plugin.PluginBootstrap
;
import
org.skywalking.apm.logging.ILog
;
import
org.skywalking.apm.logging.LogManager
;
...
...
@@ -50,14 +51,13 @@ public class AgentClassLoader extends ClassLoader {
private
List
<
File
>
classpath
;
private
List
<
Jar
>
allJars
;
private
ReentrantLock
jarScanLock
=
new
ReentrantLock
();
private
ReentrantLock
loadClassLock
=
new
ReentrantLock
();
public
static
AgentClassLoader
getDefault
()
{
return
LOADER
;
}
public
static
AgentClassLoader
initDefaultLoader
()
throws
AgentPackageNotFoundException
{
LOADER
=
new
AgentClassLoader
(
AgentClassLoader
.
class
.
getClassLoader
());
LOADER
=
new
AgentClassLoader
(
PluginBootstrap
.
class
.
getClassLoader
());
return
getDefault
();
}
...
...
@@ -69,44 +69,15 @@ public class AgentClassLoader extends ClassLoader {
classpath
.
add
(
new
File
(
agentDictionary
,
"activations"
));
}
protected
Class
<?>
loadClass
(
String
name
,
boolean
resolve
)
throws
ClassNotFoundException
{
loadClassLock
.
lock
();
try
{
// First, check if the class has already been loaded
Class
<?>
c
=
findLoadedClass
(
name
);
if
(
c
==
null
)
{
try
{
super
.
loadClass
(
name
,
resolve
);
}
catch
(
ClassNotFoundException
e
)
{
// ClassNotFoundException thrown if class not found
// from the non-null parent class loader
}
if
(
c
==
null
)
{
// If still not found, then invoke findClass in order
// to find the class.
c
=
findClass
(
name
);
}
}
if
(
resolve
)
{
resolveClass
(
c
);
}
return
c
;
}
finally
{
loadClassLock
.
unlock
();
}
}
@Override
protected
Class
<?>
findClass
(
String
name
)
throws
ClassNotFoundException
{
List
<
Jar
>
allJars
=
getAllJars
();
String
path
=
"/"
+
name
.
replace
(
'.'
,
'/'
).
concat
(
".class"
);
String
path
=
name
.
replace
(
'.'
,
'/'
).
concat
(
".class"
);
for
(
Jar
jar
:
allJars
)
{
JarEntry
entry
=
jar
.
jarFile
.
getJarEntry
(
path
);
if
(
entry
!=
null
)
{
try
{
URL
classFileUrl
=
new
URL
(
"jar:file:"
+
jar
.
sourceFile
.
getAbsolutePath
()
+
"!/"
+
name
);
URL
classFileUrl
=
new
URL
(
"jar:file:"
+
jar
.
sourceFile
.
getAbsolutePath
()
+
"!/"
+
path
);
byte
[]
data
=
null
;
BufferedInputStream
is
=
null
;
ByteArrayOutputStream
baos
=
null
;
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/plugin/loader/InterceptorInstanceLoader.java
浏览文件 @
43cf0627
...
...
@@ -66,20 +66,16 @@ public class InterceptorInstanceLoader {
String
instanceKey
=
className
+
"_OF_"
+
targetClassLoader
.
getClass
().
getName
()
+
"@"
+
Integer
.
toHexString
(
targetClassLoader
.
hashCode
());
Object
inst
=
INSTANCE_CACHE
.
get
(
instanceKey
);
if
(
inst
==
null
)
{
if
(
InterceptorInstanceLoader
.
class
.
getClassLoader
().
equals
(
targetClassLoader
))
{
inst
=
targetClassLoader
.
loadClass
(
className
).
newInstance
();
}
else
{
INSTANCE_LOAD_LOCK
.
lock
();
try
{
ClassLoader
pluginLoader
=
EXTEND_PLUGIN_CLASSLOADERS
.
get
(
targetClassLoader
);
if
(
pluginLoader
==
null
)
{
pluginLoader
=
new
AgentClassLoader
(
targetClassLoader
);
EXTEND_PLUGIN_CLASSLOADERS
.
put
(
targetClassLoader
,
pluginLoader
);
}
inst
=
Class
.
forName
(
className
,
true
,
pluginLoader
).
newInstance
();
}
finally
{
INSTANCE_LOAD_LOCK
.
unlock
();
INSTANCE_LOAD_LOCK
.
lock
();
try
{
ClassLoader
pluginLoader
=
EXTEND_PLUGIN_CLASSLOADERS
.
get
(
targetClassLoader
);
if
(
pluginLoader
==
null
)
{
pluginLoader
=
new
AgentClassLoader
(
targetClassLoader
);
EXTEND_PLUGIN_CLASSLOADERS
.
put
(
targetClassLoader
,
pluginLoader
);
}
inst
=
Class
.
forName
(
className
,
true
,
pluginLoader
).
newInstance
();
}
finally
{
INSTANCE_LOAD_LOCK
.
unlock
();
}
if
(
inst
!=
null
)
{
INSTANCE_CACHE
.
put
(
instanceKey
,
inst
);
...
...
apm-sniffer/apm-agent/pom.xml
浏览文件 @
43cf0627
...
...
@@ -35,8 +35,6 @@
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<premain.class>
org.skywalking.apm.agent.SkyWalkingAgent
</premain.class>
<shade.package>
org.skywalking.apm.dependencies
</shade.package>
<shade.net.bytebuddy.source>
net.bytebuddy
</shade.net.bytebuddy.source>
<shade.net.bytebuddy.target>
${shade.package}.${shade.net.bytebuddy.source}
</shade.net.bytebuddy.target>
</properties>
...
...
apm-sniffer/apm-sdk-plugin/pom.xml
浏览文件 @
43cf0627
...
...
@@ -55,6 +55,8 @@
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<sdk.plugin.related.dir></sdk.plugin.related.dir>
<shade.net.bytebuddy.source>
net.bytebuddy
</shade.net.bytebuddy.source>
<shade.net.bytebuddy.target>
${shade.package}.${shade.net.bytebuddy.source}
</shade.net.bytebuddy.target>
</properties>
<dependencies>
...
...
@@ -62,6 +64,13 @@
<groupId>
org.skywalking
</groupId>
<artifactId>
apm-agent-core
</artifactId>
<version>
${project.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.skywalking
</groupId>
<artifactId>
apm-util
</artifactId>
<version>
${project.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.skywalking
</groupId>
...
...
@@ -73,6 +82,44 @@
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-shade-plugin
</artifactId>
<version>
2.4.1
</version>
<executions>
<execution>
<phase>
package
</phase>
<goals>
<goal>
shade
</goal>
</goals>
<configuration>
<shadedArtifactAttached>
false
</shadedArtifactAttached>
<createDependencyReducedPom>
true
</createDependencyReducedPom>
<createSourcesJar>
true
</createSourcesJar>
<shadeSourcesContent>
true
</shadeSourcesContent>
<artifactSet>
<excludes>
<exclude>
com.lmax:*
</exclude>
<exclude>
org.apache.httpcomponents:*
</exclude>
<exclude>
commons-logging:*
</exclude>
<exclude>
commons-codec:*
</exclude>
<exclude>
*:gson
</exclude>
<exclude>
io.grpc:*
</exclude>
<exclude>
io.netty:*
</exclude>
<exclude>
com.google.*:*
</exclude>
<exclude>
com.google.guava:guava
</exclude>
</excludes>
</artifactSet>
<relocations>
<relocation>
<pattern>
${shade.net.bytebuddy.source}
</pattern>
<shadedPattern>
${shade.net.bytebuddy.target}
</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-resources-plugin
</artifactId>
...
...
apm-sniffer/apm-toolkit-activation/pom.xml
浏览文件 @
43cf0627
...
...
@@ -37,8 +37,73 @@
<artifactId>
apm-toolkit-activation
</artifactId>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<shade.net.bytebuddy.source>
net.bytebuddy
</shade.net.bytebuddy.source>
<shade.net.bytebuddy.target>
${shade.package}.${shade.net.bytebuddy.source}
</shade.net.bytebuddy.target>
</properties>
<dependencies>
<dependency>
<groupId>
org.skywalking
</groupId>
<artifactId>
apm-agent-core
</artifactId>
<version>
${project.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.skywalking
</groupId>
<artifactId>
apm-util
</artifactId>
<version>
${project.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.skywalking
</groupId>
<artifactId>
apm-test-tools
</artifactId>
<version>
${project.version}
</version>
<scope>
provided
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-shade-plugin
</artifactId>
<version>
2.4.1
</version>
<executions>
<execution>
<phase>
package
</phase>
<goals>
<goal>
shade
</goal>
</goals>
<configuration>
<shadedArtifactAttached>
false
</shadedArtifactAttached>
<createDependencyReducedPom>
true
</createDependencyReducedPom>
<createSourcesJar>
true
</createSourcesJar>
<shadeSourcesContent>
true
</shadeSourcesContent>
<artifactSet>
<excludes>
<exclude>
com.lmax:*
</exclude>
<exclude>
org.apache.httpcomponents:*
</exclude>
<exclude>
commons-logging:*
</exclude>
<exclude>
commons-codec:*
</exclude>
<exclude>
*:gson
</exclude>
<exclude>
io.grpc:*
</exclude>
<exclude>
io.netty:*
</exclude>
<exclude>
com.google.*:*
</exclude>
<exclude>
com.google.guava:guava
</exclude>
</excludes>
</artifactSet>
<relocations>
<relocation>
<pattern>
${shade.net.bytebuddy.source}
</pattern>
<shadedPattern>
${shade.net.bytebuddy.target}
</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-antrun-plugin
</artifactId>
...
...
@@ -86,17 +151,4 @@
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>
org.skywalking
</groupId>
<artifactId>
apm-agent-core
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
org.skywalking
</groupId>
<artifactId>
apm-test-tools
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
</project>
apm-sniffer/pom.xml
浏览文件 @
43cf0627
...
...
@@ -40,13 +40,14 @@
<properties>
<compiler.version>
1.6
</compiler.version>
<shade.package>
org.skywalking.apm.dependencies
</shade.package>
</properties>
<dependencies>
<dependency>
<groupId>
org.skywalking
</groupId>
<artifactId>
apm-util
</artifactId>
<version>
3.2.3-2017
</version>
<version>
${project.version}
</version>
</dependency>
</dependencies>
</project>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录