Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
SkyWalking
提交
c69b02d2
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 搜索 >>
提交
c69b02d2
编写于
11月 11, 2015
作者:
Z
zhangxin10
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1. 解决不重连的问题
上级
7a270e48
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
29 deletion
+36
-29
skywalking-api/src/main/java/com/ai/cloud/skywalking/sender/DataSenderFactory.java
...ava/com/ai/cloud/skywalking/sender/DataSenderFactory.java
+7
-1
skywalking-api/src/test/java/com/ai/cloud/skywalking/buffer/SpanBufferTest.java
...t/java/com/ai/cloud/skywalking/buffer/SpanBufferTest.java
+17
-26
skywalking-api/src/test/java/com/ai/cloud/skywalking/sender/SenderTest.java
.../test/java/com/ai/cloud/skywalking/sender/SenderTest.java
+12
-2
未找到文件。
skywalking-api/src/main/java/com/ai/cloud/skywalking/sender/DataSenderFactory.java
浏览文件 @
c69b02d2
...
...
@@ -40,6 +40,13 @@ public class DataSenderFactory {
}
public
static
DataSender
getSender
()
{
while
(
availableSenders
.
size
()
<=
0
){
try
{
Thread
.
sleep
(
2000L
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
return
availableSenders
.
get
(
ThreadLocalRandom
.
current
().
nextInt
(
0
,
availableSenders
.
size
()));
}
...
...
@@ -70,7 +77,6 @@ public class DataSenderFactory {
public
void
run
()
{
while
(
true
)
{
//当可用的Sender的数量和保存的地址的比例不在1:2,则不创建
for
(
SocketAddress
socketAddress
:
unUsedSocketAddresses
)
{
if
(
availableSenders
.
size
()
>=
avaiableSize
)
{
break
;
...
...
skywalking-api/src/test/java/com/ai/cloud/skywalking/buffer/SpanBufferTest.java
浏览文件 @
c69b02d2
...
...
@@ -37,7 +37,7 @@ public class SpanBufferTest {
@Parameterized
.
Parameters
public
static
Collection
<
Integer
[]>
getParams
()
{
return
Arrays
.
asList
(
new
Integer
[][]{
{
2000
,
10
},
{
1
,
10001
},
// {2000, 100000, 5, 27000, 3},
// {2000, 100000, 5, 24000, 3},
// {2000, 100000, 5, 20000, 2},
...
...
@@ -50,33 +50,24 @@ public class SpanBufferTest {
@Test
public
void
testSave
()
throws
Exception
{
System
.
out
.
println
(
threadSize
+
" "
+
sizeCount
);
CountDownLatch
countDownLatch
=
new
CountDownLatch
(
threadSize
);
long
start
=
System
.
currentTimeMillis
();
long
sleepTime
=
1000
;
for
(
int
i
=
0
;
i
<
threadSize
;
i
++)
{
if
(
i
%
100
==
0
)
{
sleepTime
=
sleepTime
/
2
;
if
(
sleepTime
==
0
){
sleepTime
=
5
;
while
(
true
)
{
System
.
out
.
println
(
threadSize
+
" "
+
sizeCount
);
CountDownLatch
countDownLatch
=
new
CountDownLatch
(
threadSize
);
long
start
=
System
.
currentTimeMillis
();
long
sleepTime
=
1000
;
for
(
int
i
=
0
;
i
<
threadSize
;
i
++)
{
if
(
i
%
100
==
0
)
{
sleepTime
=
sleepTime
/
2
;
if
(
sleepTime
==
0
)
{
sleepTime
=
5
;
}
Thread
.
sleep
(
sleepTime
);
}
Thread
.
sleep
(
sleepTime
);
new
ContextBufferThread
(
countDownLatch
,
sizeCount
).
start
(
);
}
new
ContextBufferThread
(
countDownLatch
,
sizeCount
).
start
();
}
countDownLatch
.
await
();
CountDownLatch
countDownLatchA
=
new
CountDownLatch
(
threadSize
);
sleepTime
=
1000
;
for
(
int
i
=
0
;
i
<
threadSize
;
i
++)
{
if
(
i
%
100
==
0
)
{
sleepTime
=
sleepTime
/
2
;
if
(
sleepTime
==
0
){
sleepTime
=
5
;
}
Thread
.
sleep
(
sleepTime
);
}
new
ContextBufferThreadA
(
countDownLatchA
,
sizeCount
).
start
();
countDownLatch
.
await
();
Thread
.
sleep
(
5000L
);
}
countDownLatchA
.
await
();
}
}
\ No newline at end of file
skywalking-api/src/test/java/com/ai/cloud/skywalking/sender/SenderTest.java
浏览文件 @
c69b02d2
package
com.ai.cloud.skywalking.sender
;
import
com.ai.cloud.skywalking.buffer.ContextBuffer
;
import
com.ai.cloud.skywalking.conf.Config
;
import
com.ai.cloud.skywalking.conf.ConfigInitializer
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runners.Parameterized
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Properties
;
import
java.util.concurrent.CountDownLatch
;
@RunWith
(
Parameterized
.
class
)
...
...
@@ -21,12 +27,16 @@ public class SenderTest {
@Parameterized
.
Parameters
public
static
Collection
<
Integer
[]>
getParams
()
{
return
Arrays
.
asList
(
new
Integer
[][]{
{
1
,
100
},
{
1
,
100
00000
},
});
}
@Test
public
void
testSender
()
throws
InterruptedException
{
public
void
testSender
()
throws
InterruptedException
,
IllegalAccessException
,
IOException
{
InputStream
inputStream
=
ContextBuffer
.
class
.
getResourceAsStream
(
"/sky-walking.auth"
);
Properties
properties
=
new
Properties
();
properties
.
load
(
inputStream
);
ConfigInitializer
.
initialize
(
properties
,
Config
.
class
);
CountDownLatch
countDownLatch
=
new
CountDownLatch
(
threadSize
*
countSize
);
for
(
int
i
=
0
;
i
<
threadSize
;
i
++)
{
Thread
.
sleep
(
1L
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录