Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
山不在高_有仙则灵
SkyWalking
提交
3d8a780f
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,发现更多精彩内容 >>
提交
3d8a780f
编写于
1月 13, 2016
作者:
Z
zhangxin10
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1. 移除在static的时候获取初始化sender
2. 修复ParentLevel为null判断
上级
4a95381c
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
210 addition
and
218 deletion
+210
-218
skywalking-api/src/main/java/com/ai/cloud/skywalking/model/ContextData.java
.../main/java/com/ai/cloud/skywalking/model/ContextData.java
+1
-1
skywalking-api/src/main/java/com/ai/cloud/skywalking/sender/DataSenderFactoryWithBalance.java
...cloud/skywalking/sender/DataSenderFactoryWithBalance.java
+204
-217
skywalking-api/src/main/java/com/ai/cloud/skywalking/sender/DataSenderWithCopies.java
.../com/ai/cloud/skywalking/sender/DataSenderWithCopies.java
+5
-0
未找到文件。
skywalking-api/src/main/java/com/ai/cloud/skywalking/model/ContextData.java
浏览文件 @
3d8a780f
...
...
@@ -54,7 +54,7 @@ public class ContextData {
StringBuilder
stringBuilder
=
new
StringBuilder
();
stringBuilder
.
append
(
traceId
);
stringBuilder
.
append
(
"-"
);
if
(
parentLevel
!=
null
&&
parentLevel
.
length
()
>
0
)
{
if
(
parentLevel
==
null
||
parentLevel
.
length
()
==
0
)
{
stringBuilder
.
append
(
" "
);
}
else
{
stringBuilder
.
append
(
parentLevel
);
...
...
skywalking-api/src/main/java/com/ai/cloud/skywalking/sender/DataSenderFactoryWithBalance.java
浏览文件 @
3d8a780f
...
...
@@ -62,23 +62,6 @@ public class DataSenderFactoryWithBalance {
*
Config
.
Buffer
.
POOL_SIZE
;
}
// 初始化的发送程序
int
index
=
0
;
while
(
usingDataSender
.
size
()
<
maxKeepConnectingSenderSize
)
{
index
=
ThreadLocalRandom
.
current
().
nextInt
(
0
,
unusedServerAddresses
.
size
());
try
{
usingDataSender
.
add
(
new
DataSender
(
unusedServerAddresses
.
get
(
index
)));
unusedServerAddresses
.
remove
(
index
);
}
catch
(
IOException
e
)
{
// 服务器连接不上
logger
.
log
(
Level
.
SEVERE
,
"Failed to connect server["
+
unusedServerAddresses
.
get
(
index
).
getHostName
()
+
"]"
);
continue
;
}
}
new
DataSenderChecker
().
start
();
}
...
...
@@ -87,26 +70,20 @@ public class DataSenderFactoryWithBalance {
DataSenderWithCopies
readySender
=
new
DataSenderWithCopies
(
maxKeepConnectingSenderSize
);
while
(
true
)
{
try
{
if
(
usingDataSender
.
size
()
==
0
)
{
try
{
Thread
.
sleep
(
RETRY_GET_SENDER_WAIT_INTERVAL
);
}
catch
(
InterruptedException
e
)
{
logger
.
log
(
Level
.
ALL
,
"Sleep failed"
);
}
}
if
(
usingDataSender
.
size
()
>
0
)
{
int
index
=
ThreadLocalRandom
.
current
().
nextInt
(
0
,
usingDataSender
.
size
());
if
(
usingDataSender
.
get
(
index
).
getStatus
()
==
DataSender
.
SenderStatus
.
READY
)
{
while
(
readySender
.
append
(
usingDataSender
.
get
(
index
)))
{
if
(++
index
==
usingDataSender
.
size
())
{
while
(
readySender
.
append
(
usingDataSender
.
get
(
index
)))
{
if
(++
index
==
usingDataSender
.
size
())
{
index
=
0
;
}
}
break
;
}
}
if
(
readySender
==
null
)
{
if
(!
readySender
.
isReady
()
)
{
try
{
Thread
.
sleep
(
RETRY_GET_SENDER_WAIT_INTERVAL
);
}
catch
(
InterruptedException
e
)
{
...
...
@@ -209,10 +186,19 @@ public class DataSenderFactoryWithBalance {
}
private
static
DataSender
findReadySender
()
{
DataSender
result
=
null
;
for
(
InetSocketAddress
serverAddress
:
unusedServerAddresses
)
{
int
index
=
ThreadLocalRandom
.
current
().
nextInt
(
0
,
unusedServerAddresses
.
size
());
for
(
int
i
=
0
;
i
<
unusedServerAddresses
.
size
();
i
++,
index
++)
{
if
(
index
==
unusedServerAddresses
.
size
()){
index
=
0
;
}
try
{
result
=
new
DataSender
(
serverAddress
);
result
=
new
DataSender
(
unusedServerAddresses
.
get
(
index
));
unusedServerAddresses
.
remove
(
index
);
break
;
}
catch
(
IOException
e
)
{
if
(
result
!=
null
)
{
...
...
@@ -221,6 +207,7 @@ public class DataSenderFactoryWithBalance {
continue
;
}
}
return
result
;
}
...
...
skywalking-api/src/main/java/com/ai/cloud/skywalking/sender/DataSenderWithCopies.java
浏览文件 @
3d8a780f
...
...
@@ -37,6 +37,11 @@ public class DataSenderWithCopies implements IDataSender {
return
senders
.
size
()
<
maxCopyNum
;
}
boolean
isReady
(){
return
senders
.
size
()
>
0
;
}
/**
* 尝试向所有副本发送
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录