Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
ab7466b3
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看板
提交
ab7466b3
编写于
6月 11, 2010
作者:
A
alanb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6934585: TEST_BUG: java/nio/channels/AsynchronousSocketChannel/Basic.java
Reviewed-by: chegar
上级
a74ecd25
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
66 addition
and
62 deletion
+66
-62
test/ProblemList.txt
test/ProblemList.txt
+2
-8
test/java/nio/channels/AsynchronousSocketChannel/Basic.java
test/java/nio/channels/AsynchronousSocketChannel/Basic.java
+64
-54
未找到文件。
test/ProblemList.txt
浏览文件 @
ab7466b3
...
...
@@ -737,9 +737,6 @@ sun/net/www/protocol/http/DigestTest.java generic-all
# Suspect many of these tests auffer from using fixed ports, no concrete
# evidence.
# Failing on Solaris x86 and Linux x86, filed 6934585
java/nio/channels/AsynchronousSocketChannel/Basic.java generic-all
# Occasionally Failing with java.lang.AssertionError on Windows X64
# at sun.nio.ch.PendingIoCache.clearPendingIoMap(PendingIoCache.java:144)
#java/nio/channels/FileChannel/ReleaseOnCloseDeadlock.java windows-all
...
...
@@ -767,10 +764,6 @@ java/nio/channels/Selector/SelectWrite.java generic-all
# Fails on Fedora 9 32bit times out
java/nio/channels/DatagramChannel/EmptyBuffer.java generic-all
# Fails on Windows 2000, ExceptionInInitializerError
# in WindowsAsynchronousServerSocketChannelImpl.java:316
java/nio/channels/AsynchronousChannelGroup/Unbounded.java generic-all
# Fails on Windows 2000, times out
java/nio/channels/FileChannel/Transfer.java generic-all
...
...
@@ -812,11 +805,12 @@ java/nio/channels/Selector/HelperSlowToDie.java generic-all
# Timeouts etc. on Window
java/nio/channels/AsyncCloseAndInterrupt.java windows-all
# Gets java.lang.ExceptionInInitializerError on
windows: (Windows 2000 only?
)
# Gets java.lang.ExceptionInInitializerError on
Windows 2000 (need XP or newer
)
java/nio/channels/AsynchronousChannelGroup/Basic.java windows-5.0
java/nio/channels/AsynchronousChannelGroup/GroupOfOne.java windows-5.0
java/nio/channels/AsynchronousChannelGroup/Identity.java windows-5.0
java/nio/channels/AsynchronousChannelGroup/Restart.java windows-5.0
java/nio/channels/AsynchronousChannelGroup/Unbounded.java windows-5.0
java/nio/channels/AsynchronousDatagramChannel/Basic.java windows-5.0
java/nio/channels/AsynchronousFileChannel/Lock.java windows-5.0
java/nio/channels/AsynchronousServerSocketChannel/Basic.java windows-5.0
...
...
test/java/nio/channels/AsynchronousSocketChannel/Basic.java
浏览文件 @
ab7466b3
...
...
@@ -196,18 +196,16 @@ public class Basic {
System
.
out
.
println
(
"-- connect to non-existent host --"
);
// test failure
InetAddress
badHost
=
InetAddress
.
getByName
(
"1.2.3.4"
);
if
(!
badHost
.
isReachable
(
10
*
1000
))
{
ch
=
AsynchronousSocketChannel
.
open
();
try
{
ch
.
connect
(
new
InetSocketAddress
(
badHost
,
9876
)).
get
();
throw
new
RuntimeException
(
"Connection should not be established"
);
}
catch
(
ExecutionException
x
)
{
}
// test that failure to connect closes the channel
ch
=
AsynchronousSocketChannel
.
open
();
try
{
ch
.
connect
(
genSocketAddress
()).
get
();
}
catch
(
ExecutionException
x
)
{
// failed to establish connection
if
(
ch
.
isOpen
())
throw
new
RuntimeException
(
"Channel should be closed"
);
}
finally
{
ch
.
close
();
}
server
.
close
();
...
...
@@ -219,27 +217,22 @@ public class Basic {
AsynchronousSocketChannel
ch
;
// asynchronous close while connecting
InetAddress
rh
=
InetAddress
.
getByName
(
"1.2.3.4"
);
if
(!
rh
.
isReachable
(
3000
))
{
InetSocketAddress
isa
=
new
InetSocketAddress
(
rh
,
1234
);
ch
=
AsynchronousSocketChannel
.
open
();
Future
<
Void
>
result
=
ch
.
connect
(
isa
);
ch
=
AsynchronousSocketChannel
.
open
();
Future
<
Void
>
connectResult
=
ch
.
connect
(
genSocketAddress
());
// give time to initiate the connect (SYN)
Thread
.
sleep
(
50
);
// give time to initiate the connect (SYN)
Thread
.
sleep
(
50
);
// close
ch
.
close
();
// close
ch
.
close
();
// check that AsynchronousCloseException is thrown
try
{
result
.
get
();
throw
new
RuntimeException
(
"Should not connect"
);
}
catch
(
ExecutionException
x
)
{
if
(!(
x
.
getCause
()
instanceof
AsynchronousCloseException
))
throw
new
RuntimeException
(
x
);
}
// check that exception is thrown in timely manner
try
{
connectResult
.
get
(
5
,
TimeUnit
.
SECONDS
);
}
catch
(
TimeoutException
x
)
{
throw
new
RuntimeException
(
"AsynchronousCloseException not thrown"
);
}
catch
(
ExecutionException
x
)
{
// expected
}
System
.
out
.
println
(
"-- asynchronous close when reading --"
);
...
...
@@ -785,30 +778,47 @@ public class Basic {
ch
.
close
();
}
// returns ByteBuffer with random bytes
static
ByteBuffer
genBuffer
()
{
int
size
=
1024
+
rand
.
nextInt
(
16000
);
byte
[]
buf
=
new
byte
[
size
];
rand
.
nextBytes
(
buf
);
boolean
useDirect
=
rand
.
nextBoolean
();
if
(
useDirect
)
{
ByteBuffer
bb
=
ByteBuffer
.
allocateDirect
(
buf
.
length
);
bb
.
put
(
buf
);
bb
.
flip
();
return
bb
;
}
else
{
return
ByteBuffer
.
wrap
(
buf
);
}
}
// return ByteBuffer[] with random bytes
static
ByteBuffer
[]
genBuffers
(
int
max
)
{
int
len
=
1
;
if
(
max
>
1
)
len
+=
rand
.
nextInt
(
max
);
ByteBuffer
[]
bufs
=
new
ByteBuffer
[
len
];
for
(
int
i
=
0
;
i
<
len
;
i
++)
bufs
[
i
]
=
genBuffer
();
return
bufs
;
}
// returns ByteBuffer with random bytes
static
ByteBuffer
genBuffer
()
{
int
size
=
1024
+
rand
.
nextInt
(
16000
);
byte
[]
buf
=
new
byte
[
size
];
rand
.
nextBytes
(
buf
);
boolean
useDirect
=
rand
.
nextBoolean
();
if
(
useDirect
)
{
ByteBuffer
bb
=
ByteBuffer
.
allocateDirect
(
buf
.
length
);
bb
.
put
(
buf
);
bb
.
flip
();
return
bb
;
}
else
{
return
ByteBuffer
.
wrap
(
buf
);
}
}
// return ByteBuffer[] with random bytes
static
ByteBuffer
[]
genBuffers
(
int
max
)
{
int
len
=
1
;
if
(
max
>
1
)
len
+=
rand
.
nextInt
(
max
);
ByteBuffer
[]
bufs
=
new
ByteBuffer
[
len
];
for
(
int
i
=
0
;
i
<
len
;
i
++)
bufs
[
i
]
=
genBuffer
();
return
bufs
;
}
// return random SocketAddress
static
SocketAddress
genSocketAddress
()
{
StringBuilder
sb
=
new
StringBuilder
(
"10."
);
sb
.
append
(
rand
.
nextInt
(
256
));
sb
.
append
(
'.'
);
sb
.
append
(
rand
.
nextInt
(
256
));
sb
.
append
(
'.'
);
sb
.
append
(
rand
.
nextInt
(
256
));
InetAddress
rh
;
try
{
rh
=
InetAddress
.
getByName
(
sb
.
toString
());
}
catch
(
UnknownHostException
x
)
{
throw
new
InternalError
(
"Should not happen"
);
}
return
new
InetSocketAddress
(
rh
,
rand
.
nextInt
(
65535
)+
1
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录