Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
2f57e38d
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看板
提交
2f57e38d
编写于
6月 17, 2014
作者:
P
prappo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8047062: Improve diagnostic output in com/sun/jndi/ldap/LdapTimeoutTest.java
Reviewed-by: vinnie
上级
16bf7c27
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
19 addition
and
10 deletion
+19
-10
src/share/classes/com/sun/jndi/ldap/Connection.java
src/share/classes/com/sun/jndi/ldap/Connection.java
+2
-1
test/com/sun/jndi/ldap/LdapTimeoutTest.java
test/com/sun/jndi/ldap/LdapTimeoutTest.java
+17
-9
未找到文件。
src/share/classes/com/sun/jndi/ldap/Connection.java
浏览文件 @
2f57e38d
...
...
@@ -111,6 +111,7 @@ public final class Connection implements Runnable {
private
static
final
boolean
debug
=
false
;
private
static
final
int
dump
=
0
;
// > 0 r, > 1 rw
public
static
final
long
DEFAULT_READ_TIMEOUT_MILLIS
=
15
*
1000
;
// 15 second timeout;
final
private
Thread
worker
;
// Initialized in constructor
...
...
@@ -460,7 +461,7 @@ public final class Connection implements Runnable {
// available
ldr
.
wait
(
readTimeout
);
}
else
{
ldr
.
wait
(
15
*
1000
);
// 15 second timeout
ldr
.
wait
(
DEFAULT_READ_TIMEOUT_MILLIS
);
}
waited
=
true
;
}
else
{
...
...
test/com/sun/jndi/ldap/LdapTimeoutTest.java
浏览文件 @
2f57e38d
...
...
@@ -27,6 +27,8 @@
* @summary Timeout tests for ldap
*/
import
com.sun.jndi.ldap.Connection
;
import
java.net.Socket
;
import
java.net.ServerSocket
;
import
java.net.SocketTimeoutException
;
...
...
@@ -38,7 +40,9 @@ import java.util.concurrent.Callable;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.ScheduledFuture
;
import
java.util.concurrent.TimeUnit
;
import
static
java
.
util
.
concurrent
.
TimeUnit
.
MILLISECONDS
;
import
static
java
.
util
.
concurrent
.
TimeUnit
.
NANOSECONDS
;
public
class
LdapTimeoutTest
{
private
static
final
ScheduledExecutorService
pool
=
...
...
@@ -85,7 +89,7 @@ public class LdapTimeoutTest {
void
ldapReadTimeoutTest
(
Hashtable
env
,
boolean
ssl
)
{
InitialContext
ctx
=
null
;
if
(
ssl
)
env
.
put
(
Context
.
SECURITY_PROTOCOL
,
"ssl"
);
ScheduledFuture
killer
=
killSwitch
(
5000
);
ScheduledFuture
killer
=
killSwitch
(
5
_
000
);
long
start
=
System
.
nanoTime
();
try
{
ctx
=
new
InitialDirContext
(
env
);
...
...
@@ -113,7 +117,7 @@ public class LdapTimeoutTest {
void
simpleAuthConnectTest
(
Hashtable
env
)
{
InitialContext
ctx
=
null
;
ScheduledFuture
killer
=
killSwitch
(
5000
);
ScheduledFuture
killer
=
killSwitch
(
5
_
000
);
long
start
=
System
.
nanoTime
();
try
{
ctx
=
new
InitialDirContext
(
env
);
...
...
@@ -123,7 +127,7 @@ public class LdapTimeoutTest {
}
catch
(
NamingException
e
)
{
long
end
=
System
.
nanoTime
();
if
(
e
.
getCause
()
instanceof
SocketTimeoutException
)
{
if
(
TimeUnit
.
NANOSECONDS
.
toMillis
(
end
-
start
)
<
2
900
)
{
if
(
NANOSECONDS
.
toMillis
(
end
-
start
)
<
2_
900
)
{
pass
();
}
else
{
System
.
err
.
println
(
"Fail: Waited too long"
);
...
...
@@ -142,7 +146,7 @@ public class LdapTimeoutTest {
void
deadServerNoTimeout
(
Hashtable
env
)
{
InitialContext
ctx
=
null
;
ScheduledFuture
killer
=
killSwitch
(
30000
);
ScheduledFuture
killer
=
killSwitch
(
30
_
000
);
long
start
=
System
.
nanoTime
();
try
{
ctx
=
new
InitialDirContext
(
env
);
...
...
@@ -154,9 +158,13 @@ public class LdapTimeoutTest {
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
));
long
elapsed
=
NANOSECONDS
.
toMillis
(
end
-
start
);
if
(
elapsed
<
Connection
.
DEFAULT_READ_TIMEOUT_MILLIS
)
{
System
.
err
.
printf
(
"fail: timeout should be at least %s ms, actual time is %s ms"
,
Connection
.
DEFAULT_READ_TIMEOUT_MILLIS
,
elapsed
);
e
.
printStackTrace
();
fail
();
}
else
{
pass
();
...
...
@@ -184,7 +192,7 @@ public class LdapTimeoutTest {
System
.
exit
(
0
);
return
null
;
}
},
ms
,
TimeUnit
.
MILLISECONDS
);
},
ms
,
MILLISECONDS
);
}
static
class
Server
extends
Thread
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录