Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
7fd25f07
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7fd25f07
编写于
10月 05, 2010
作者:
A
alanb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6987116: (so) test/java/nio/channels/SocketChannel/VectorIO.java failed on Solaris 11
Reviewed-by: forax
上级
90152284
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
13 deletion
+30
-13
test/java/nio/channels/SocketChannel/VectorIO.java
test/java/nio/channels/SocketChannel/VectorIO.java
+30
-13
未找到文件。
test/java/nio/channels/SocketChannel/VectorIO.java
浏览文件 @
7fd25f07
...
...
@@ -60,6 +60,7 @@ public class VectorIO {
static
void
bufferTest
(
int
port
)
throws
Exception
{
ByteBuffer
[]
bufs
=
new
ByteBuffer
[
testSize
];
long
total
=
0L
;
for
(
int
i
=
0
;
i
<
testSize
;
i
++)
{
String
source
=
"buffer"
+
i
;
if
(
generator
.
nextBoolean
())
...
...
@@ -69,6 +70,7 @@ public class VectorIO {
bufs
[
i
].
put
(
source
.
getBytes
(
"8859_1"
));
bufs
[
i
].
flip
();
total
+=
bufs
[
i
].
remaining
();
}
// Get a connection to the server
...
...
@@ -76,17 +78,20 @@ public class VectorIO {
InetSocketAddress
isa
=
new
InetSocketAddress
(
lh
,
port
);
SocketChannel
sc
=
SocketChannel
.
open
();
sc
.
connect
(
isa
);
sc
.
configureBlocking
(
false
);
sc
.
configureBlocking
(
generator
.
nextBoolean
()
);
// Write the data out
long
bytesWritten
=
0
;
do
{
bytesWritten
=
sc
.
write
(
bufs
);
}
while
(
bytesWritten
>
0
);
try
{
Thread
.
currentThread
().
sleep
(
500
);
}
catch
(
InterruptedException
ie
)
{
}
long
rem
=
total
;
while
(
rem
>
0L
)
{
long
bytesWritten
=
sc
.
write
(
bufs
);
if
(
bytesWritten
==
0
)
{
if
(
sc
.
isBlocking
())
throw
new
RuntimeException
(
"write did not block"
);
Thread
.
sleep
(
50
);
}
else
{
rem
-=
bytesWritten
;
}
}
// Clean up
sc
.
close
();
...
...
@@ -115,6 +120,7 @@ public class VectorIO {
}
void
bufferTest
()
throws
Exception
{
long
total
=
0L
;
ByteBuffer
[]
bufs
=
new
ByteBuffer
[
testSize
];
for
(
int
i
=
0
;
i
<
testSize
;
i
++)
{
String
source
=
"buffer"
+
i
;
...
...
@@ -122,6 +128,7 @@ public class VectorIO {
bufs
[
i
]
=
ByteBuffer
.
allocateDirect
(
source
.
length
());
else
bufs
[
i
]
=
ByteBuffer
.
allocate
(
source
.
length
());
total
+=
bufs
[
i
].
capacity
();
}
// Get a connection from client
...
...
@@ -138,11 +145,21 @@ public class VectorIO {
Thread
.
sleep
(
50
);
}
sc
.
configureBlocking
(
generator
.
nextBoolean
());
// Read data into multiple buffers
long
bytesRead
=
0
;
do
{
bytesRead
=
sc
.
read
(
bufs
);
}
while
(
bytesRead
>
0
);
long
avail
=
total
;
while
(
avail
>
0
)
{
long
bytesRead
=
sc
.
read
(
bufs
);
if
(
bytesRead
<
0
)
break
;
if
(
bytesRead
==
0
)
{
if
(
sc
.
isBlocking
())
throw
new
RuntimeException
(
"read did not block"
);
Thread
.
sleep
(
50
);
}
avail
-=
bytesRead
;
}
// Check results
for
(
int
i
=
0
;
i
<
testSize
;
i
++)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录