Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
1c84fcf0
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1c84fcf0
编写于
6月 15, 2010
作者:
A
alanb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6932744: TEST_BUG: java/nio/channels/Selector/OpRead.java failing
Reviewed-by: chegar
上级
ed15c7a1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
39 addition
and
38 deletion
+39
-38
test/ProblemList.txt
test/ProblemList.txt
+0
-3
test/java/nio/channels/Selector/OpRead.java
test/java/nio/channels/Selector/OpRead.java
+39
-35
未找到文件。
test/ProblemList.txt
浏览文件 @
1c84fcf0
...
...
@@ -816,9 +816,6 @@ java/nio/channels/Channels/Basic2.java windows-5.0
# Considered a stress test, can consume all resources.
java/nio/channels/Selector/LotsOfChannels.java generic-all
# Solaris sparcv9, just fails with exception
java/nio/channels/Selector/OpRead.java solaris-sparc
# Windows i586 client, crashed hotspot? Unpredictable
# Considered a stress test, can consume all resources.
java/nio/channels/Selector/RegAfterPreClose.java generic-all
...
...
test/java/nio/channels/Selector/OpRead.java
浏览文件 @
1c84fcf0
...
...
@@ -24,59 +24,63 @@
/* @test
* @bug 4755720
* @summary Test if OP_READ is detected with OP_WRITE in interestOps
* @library ..
*/
import
java.net.*
;
import
java.io.*
;
import
java.nio.*
;
import
java.nio.channels.*
;
import
java.nio.channels.spi.SelectorProvider
;
import
java.util.*
;
public
class
OpRead
{
static
final
int
DAYTIME_PORT
=
13
;
static
final
String
DAYTIME_HOST
=
TestUtil
.
HOST
;
static
void
test
()
throws
Exception
{
InetSocketAddress
isa
=
new
InetSocketAddress
(
InetAddress
.
getByName
(
DAYTIME_HOST
),
DAYTIME_PORT
);
SocketChannel
sc
=
SocketChannel
.
open
();
ServerSocketChannel
ssc
=
null
;
SocketChannel
sc
=
null
;
SocketChannel
peer
=
null
;
try
{
ssc
=
ServerSocketChannel
.
open
().
bind
(
new
InetSocketAddress
(
0
));
sc
.
connect
(
isa
);
// loopback connection
InetAddress
lh
=
InetAddress
.
getLocalHost
();
sc
=
SocketChannel
.
open
(
new
InetSocketAddress
(
lh
,
ssc
.
socket
().
getLocalPort
()));
peer
=
ssc
.
accept
();
sc
.
configureBlocking
(
false
);
// peer sends message so that "sc" will be readable
int
n
=
peer
.
write
(
ByteBuffer
.
wrap
(
"Hello"
.
getBytes
()));
assert
n
>
0
;
Selector
selector
=
SelectorProvider
.
provider
().
openSelector
();
SelectionKey
key
=
sc
.
register
(
selector
,
SelectionKey
.
OP_READ
|
SelectionKey
.
OP_WRITE
);
sc
.
configureBlocking
(
false
);
boolean
done
=
false
;
int
failCount
=
0
;
while
(!
done
)
{
if
(
selector
.
select
()
>
0
)
{
Set
keys
=
selector
.
selectedKeys
();
Iterator
iterator
=
keys
.
iterator
();
while
(
iterator
.
hasNext
())
{
key
=
(
SelectionKey
)
iterator
.
next
();
iterator
.
remove
();
if
(
key
.
isWritable
())
{
failCount
++;
if
(
failCount
>
10
)
throw
new
RuntimeException
(
"Test failed"
);
Thread
.
sleep
(
100
);
}
if
(
key
.
isReadable
())
{
done
=
true
;
Selector
selector
=
Selector
.
open
();
SelectionKey
key
=
sc
.
register
(
selector
,
SelectionKey
.
OP_READ
|
SelectionKey
.
OP_WRITE
);
boolean
done
=
false
;
int
failCount
=
0
;
while
(!
done
)
{
if
(
selector
.
select
()
>
0
)
{
Set
<
SelectionKey
>
keys
=
selector
.
selectedKeys
();
Iterator
<
SelectionKey
>
iterator
=
keys
.
iterator
();
while
(
iterator
.
hasNext
())
{
key
=
iterator
.
next
();
iterator
.
remove
();
if
(
key
.
isWritable
())
{
failCount
++;
if
(
failCount
>
10
)
throw
new
RuntimeException
(
"Test failed"
);
Thread
.
sleep
(
250
);
}
if
(
key
.
isReadable
())
{
done
=
true
;
}
}
}
}
}
finally
{
if
(
peer
!=
null
)
peer
.
close
();
if
(
sc
!=
null
)
sc
.
close
();
if
(
ssc
!=
null
)
ssc
.
close
();
}
sc
.
close
();
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录