Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
802be844
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看板
提交
802be844
编写于
5月 23, 2014
作者:
R
robm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8042857: 14 stuck threads waiting for notification on LDAPRequest
Reviewed-by: vinnie
上级
a88266f1
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
38 addition
and
11 deletion
+38
-11
src/share/classes/com/sun/jndi/ldap/Connection.java
src/share/classes/com/sun/jndi/ldap/Connection.java
+2
-2
test/com/sun/jndi/ldap/LdapTimeoutTest.java
test/com/sun/jndi/ldap/LdapTimeoutTest.java
+36
-9
未找到文件。
src/share/classes/com/sun/jndi/ldap/Connection.java
浏览文件 @
802be844
/*
* Copyright (c) 1999, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -459,10 +459,10 @@ public final class Connection implements Runnable {
// will be woken up before readTimeout only if reply is
// available
ldr
.
wait
(
readTimeout
);
waited
=
true
;
}
else
{
ldr
.
wait
(
15
*
1000
);
// 15 second timeout
}
waited
=
true
;
}
else
{
break
;
}
...
...
test/com/sun/jndi/ldap/LdapTimeoutTest.java
浏览文件 @
802be844
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -64,11 +64,12 @@ public class LdapTimeoutTest {
env
.
put
(
Context
.
SECURITY_PRINCIPAL
,
"user"
);
env
.
put
(
Context
.
SECURITY_CREDENTIALS
,
"password"
);
env
.
put
(
"com.sun.jndi.ldap.connect.timeout"
,
"10"
);
env
.
put
(
"com.sun.jndi.ldap.read.timeout"
,
"3000"
);
InitialContext
ctx
=
null
;
try
{
new
LdapTimeoutTest
().
deadServerNoTimeout
(
env
);
env
.
put
(
"com.sun.jndi.ldap.connect.timeout"
,
"10"
);
env
.
put
(
"com.sun.jndi.ldap.read.timeout"
,
"3000"
);
new
LdapTimeoutTest
().
ldapReadTimeoutTest
(
env
,
false
);
new
LdapTimeoutTest
().
ldapReadTimeoutTest
(
env
,
true
);
new
LdapTimeoutTest
().
simpleAuthConnectTest
(
env
);
...
...
@@ -84,7 +85,7 @@ public class LdapTimeoutTest {
void
ldapReadTimeoutTest
(
Hashtable
env
,
boolean
ssl
)
{
InitialContext
ctx
=
null
;
if
(
ssl
)
env
.
put
(
Context
.
SECURITY_PROTOCOL
,
"ssl"
);
ScheduledFuture
killer
=
killSwitch
();
ScheduledFuture
killer
=
killSwitch
(
5000
);
long
start
=
System
.
nanoTime
();
try
{
ctx
=
new
InitialDirContext
(
env
);
...
...
@@ -112,7 +113,7 @@ public class LdapTimeoutTest {
void
simpleAuthConnectTest
(
Hashtable
env
)
{
InitialContext
ctx
=
null
;
ScheduledFuture
killer
=
killSwitch
();
ScheduledFuture
killer
=
killSwitch
(
5000
);
long
start
=
System
.
nanoTime
();
try
{
ctx
=
new
InitialDirContext
(
env
);
...
...
@@ -139,6 +140,32 @@ public class LdapTimeoutTest {
}
}
void
deadServerNoTimeout
(
Hashtable
env
)
{
InitialContext
ctx
=
null
;
ScheduledFuture
killer
=
killSwitch
(
30000
);
long
start
=
System
.
nanoTime
();
try
{
ctx
=
new
InitialDirContext
(
env
);
SearchControls
scl
=
new
SearchControls
();
scl
.
setSearchScope
(
SearchControls
.
SUBTREE_SCOPE
);
NamingEnumeration
<
SearchResult
>
answer
=
((
InitialDirContext
)
ctx
)
.
search
(
"ou=People,o=JNDITutorial"
,
"(objectClass=*)"
,
scl
);
// shouldn't reach here
fail
();
}
catch
(
NamingException
e
)
{
long
end
=
System
.
nanoTime
();
if
(
TimeUnit
.
NANOSECONDS
.
toMillis
(
end
-
start
)
<
14000
)
{
System
.
err
.
println
(
"fail: timeout should be at least 15 seconds, actual time: "
+
TimeUnit
.
NANOSECONDS
.
toMillis
(
end
-
start
));
fail
();
}
else
{
pass
();
}
}
finally
{
if
(!
shutItDown
(
killer
,
ctx
))
fail
();
}
}
boolean
shutItDown
(
ScheduledFuture
killer
,
InitialContext
ctx
)
{
killer
.
cancel
(
true
);
try
{
...
...
@@ -149,15 +176,15 @@ public class LdapTimeoutTest {
}
}
ScheduledFuture
killSwitch
()
{
ScheduledFuture
killSwitch
(
int
ms
)
{
final
Thread
current
=
Thread
.
currentThread
();
return
LdapTimeoutTest
.
pool
.
schedule
(
new
Callable
<
Void
>()
{
public
Void
call
()
throws
Exception
{
System
.
err
.
println
(
"Fail: killSwitch()"
);
current
.
interrupt
(
);
System
.
exit
(
0
);
return
null
;
}
},
5000
,
TimeUnit
.
MILLISECONDS
);
},
ms
,
TimeUnit
.
MILLISECONDS
);
}
static
class
Server
extends
Thread
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录