Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
山不在高_有仙则灵
SkyWalking
提交
12282a8e
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,发现更多精彩内容 >>
提交
12282a8e
编写于
10月 12, 2017
作者:
彭
彭勇升 Buddha
提交者:
GitHub
10月 12, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into fix/segment-cost
上级
6d1aade5
4ddcb18d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
93 addition
and
8 deletion
+93
-8
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/boot/DefaultNamedThreadFactory.java
...alking/apm/agent/core/boot/DefaultNamedThreadFactory.java
+40
-0
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/trace/NoopSpan.java
...org/skywalking/apm/agent/core/context/trace/NoopSpan.java
+1
-1
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/jvm/JVMService.java
...in/java/org/skywalking/apm/agent/core/jvm/JVMService.java
+3
-3
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/remote/AppAndServiceRegisterClient.java
...ng/apm/agent/core/remote/AppAndServiceRegisterClient.java
+2
-1
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/remote/CollectorDiscoveryService.java
...king/apm/agent/core/remote/CollectorDiscoveryService.java
+2
-1
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/remote/GRPCChannelManager.java
.../skywalking/apm/agent/core/remote/GRPCChannelManager.java
+2
-1
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/sampling/SamplingService.java
...g/skywalking/apm/agent/core/sampling/SamplingService.java
+2
-1
apm-sniffer/apm-agent-core/src/test/java/org/skywalking/apm/agent/core/boot/DefaultNamedThreadFactoryTest.java
...ng/apm/agent/core/boot/DefaultNamedThreadFactoryTest.java
+41
-0
未找到文件。
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/boot/DefaultNamedThreadFactory.java
0 → 100644
浏览文件 @
12282a8e
/*
* 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
*/
package
org.skywalking.apm.agent.core.boot
;
import
java.util.concurrent.ThreadFactory
;
import
java.util.concurrent.atomic.AtomicInteger
;
/**
* @author zhangkewei
*/
public
class
DefaultNamedThreadFactory
implements
ThreadFactory
{
private
static
final
AtomicInteger
BOOT_SERVICE_SEQ
=
new
AtomicInteger
(
0
);
private
final
AtomicInteger
threadSeq
=
new
AtomicInteger
(
0
);
private
final
String
namePrefix
;
public
DefaultNamedThreadFactory
(
String
name
)
{
namePrefix
=
"SkywalkingAgent-"
+
BOOT_SERVICE_SEQ
.
incrementAndGet
()
+
"-"
+
name
+
"-"
;
}
@Override
public
Thread
newThread
(
Runnable
r
)
{
Thread
t
=
new
Thread
();
t
.
setName
(
namePrefix
+
threadSeq
.
getAndIncrement
());
t
.
setDaemon
(
true
);
return
t
;
}
}
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/context/trace/NoopSpan.java
浏览文件 @
12282a8e
...
...
@@ -39,7 +39,7 @@ public class NoopSpan implements AbstractSpan {
}
@Override
public
AbstractSpan
errorOccurred
()
{
return
null
;
return
this
;
}
public
void
finish
()
{
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/jvm/JVMService.java
浏览文件 @
12282a8e
...
...
@@ -25,6 +25,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import
java.util.concurrent.ScheduledFuture
;
import
java.util.concurrent.TimeUnit
;
import
org.skywalking.apm.agent.core.boot.BootService
;
import
org.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory
;
import
org.skywalking.apm.agent.core.boot.ServiceManager
;
import
org.skywalking.apm.agent.core.conf.Config
;
import
org.skywalking.apm.agent.core.conf.RemoteDownstreamConfig
;
...
...
@@ -57,7 +58,6 @@ public class JVMService implements BootService, Runnable {
private
volatile
ScheduledFuture
<?>
collectMetricFuture
;
private
volatile
ScheduledFuture
<?>
sendMetricFuture
;
private
Sender
sender
;
@Override
public
void
beforeBoot
()
throws
Throwable
{
queue
=
new
LinkedBlockingQueue
(
Config
.
Jvm
.
BUFFER_SIZE
);
...
...
@@ -68,10 +68,10 @@ public class JVMService implements BootService, Runnable {
@Override
public
void
boot
()
throws
Throwable
{
collectMetricFuture
=
Executors
.
newSingleThreadScheduledExecutor
()
.
newSingleThreadScheduledExecutor
(
new
DefaultNamedThreadFactory
(
"JVMService-produce"
)
)
.
scheduleAtFixedRate
(
this
,
0
,
1
,
TimeUnit
.
SECONDS
);
sendMetricFuture
=
Executors
.
newSingleThreadScheduledExecutor
()
.
newSingleThreadScheduledExecutor
(
new
DefaultNamedThreadFactory
(
"JVMService-consume"
)
)
.
scheduleAtFixedRate
(
sender
,
0
,
1
,
TimeUnit
.
SECONDS
);
}
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/remote/AppAndServiceRegisterClient.java
浏览文件 @
12282a8e
...
...
@@ -24,6 +24,7 @@ import java.util.concurrent.Executors;
import
java.util.concurrent.ScheduledFuture
;
import
java.util.concurrent.TimeUnit
;
import
org.skywalking.apm.agent.core.boot.BootService
;
import
org.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory
;
import
org.skywalking.apm.agent.core.boot.ServiceManager
;
import
org.skywalking.apm.agent.core.conf.Config
;
import
org.skywalking.apm.agent.core.conf.RemoteDownstreamConfig
;
...
...
@@ -89,7 +90,7 @@ public class AppAndServiceRegisterClient implements BootService, GRPCChannelList
@Override
public
void
boot
()
throws
Throwable
{
applicationRegisterFuture
=
Executors
.
newSingleThreadScheduledExecutor
()
.
newSingleThreadScheduledExecutor
(
new
DefaultNamedThreadFactory
(
"AppAndServiceRegisterClient"
)
)
.
scheduleAtFixedRate
(
this
,
0
,
Config
.
Collector
.
APP_AND_SERVICE_REGISTER_CHECK_INTERVAL
,
TimeUnit
.
SECONDS
);
}
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/remote/CollectorDiscoveryService.java
浏览文件 @
12282a8e
...
...
@@ -22,6 +22,7 @@ import java.util.concurrent.Executors;
import
java.util.concurrent.ScheduledFuture
;
import
java.util.concurrent.TimeUnit
;
import
org.skywalking.apm.agent.core.boot.BootService
;
import
org.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory
;
import
org.skywalking.apm.agent.core.conf.Config
;
/**
...
...
@@ -39,7 +40,7 @@ public class CollectorDiscoveryService implements BootService {
@Override
public
void
boot
()
throws
Throwable
{
future
=
Executors
.
newSingleThreadScheduledExecutor
()
future
=
Executors
.
newSingleThreadScheduledExecutor
(
new
DefaultNamedThreadFactory
(
"CollectorDiscoveryService"
)
)
.
scheduleAtFixedRate
(
new
DiscoveryRestServiceClient
(),
0
,
Config
.
Collector
.
DISCOVERY_CHECK_INTERVAL
,
TimeUnit
.
SECONDS
);
}
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/remote/GRPCChannelManager.java
浏览文件 @
12282a8e
...
...
@@ -32,6 +32,7 @@ import java.util.concurrent.Executors;
import
java.util.concurrent.ScheduledFuture
;
import
java.util.concurrent.TimeUnit
;
import
org.skywalking.apm.agent.core.boot.BootService
;
import
org.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory
;
import
org.skywalking.apm.agent.core.conf.RemoteDownstreamConfig
;
import
org.skywalking.apm.logging.ILog
;
import
org.skywalking.apm.logging.LogManager
;
...
...
@@ -58,7 +59,7 @@ public class GRPCChannelManager implements BootService, Runnable {
@Override
public
void
boot
()
throws
Throwable
{
connectCheckFuture
=
Executors
.
newSingleThreadScheduledExecutor
()
.
newSingleThreadScheduledExecutor
(
new
DefaultNamedThreadFactory
(
"GRPCChannelManager"
)
)
.
scheduleAtFixedRate
(
this
,
0
,
GRPC_CHANNEL_CHECK_INTERVAL
,
TimeUnit
.
SECONDS
);
}
...
...
apm-sniffer/apm-agent-core/src/main/java/org/skywalking/apm/agent/core/sampling/SamplingService.java
浏览文件 @
12282a8e
...
...
@@ -24,6 +24,7 @@ import java.util.concurrent.ScheduledFuture;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
org.skywalking.apm.agent.core.boot.BootService
;
import
org.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory
;
import
org.skywalking.apm.agent.core.conf.Config
;
import
org.skywalking.apm.agent.core.context.trace.TraceSegment
;
import
org.skywalking.apm.logging.ILog
;
...
...
@@ -63,7 +64,7 @@ public class SamplingService implements BootService {
on
=
true
;
this
.
resetSamplingFactor
();
ScheduledExecutorService
service
=
Executors
.
newSingleThreadScheduledExecutor
();
.
newSingleThreadScheduledExecutor
(
new
DefaultNamedThreadFactory
(
"SamplingService"
)
);
scheduledFuture
=
service
.
scheduleAtFixedRate
(
new
Runnable
()
{
@Override
public
void
run
()
{
...
...
apm-sniffer/apm-agent-core/src/test/java/org/skywalking/apm/agent/core/boot/DefaultNamedThreadFactoryTest.java
0 → 100644
浏览文件 @
12282a8e
/*
* 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
*/
package
org.skywalking.apm.agent.core.boot
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
/**
* @author zhangkewei
*/
public
class
DefaultNamedThreadFactoryTest
{
@Test
public
void
testNamedThread
()
throws
Exception
{
Thread
newThread
=
new
DefaultNamedThreadFactory
(
"DefaultNamedThreadFactoryTest"
).
newThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
}
});
newThread
.
start
();
assertNotNull
(
newThread
.
getName
());
assert
(
newThread
.
getName
().
contains
(
"DefaultNamedThreadFactoryTest"
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录