Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
e68e60be
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
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,发现更多精彩内容 >>
提交
e68e60be
编写于
2月 10, 2016
作者:
I
igerasim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8046339: sun.rmi.transport.DGCAckHandler leaks memory
Reviewed-by: smarks
上级
abba7081
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
35 addition
and
7 deletion
+35
-7
src/share/classes/sun/rmi/transport/DGCAckHandler.java
src/share/classes/sun/rmi/transport/DGCAckHandler.java
+4
-1
test/java/rmi/dgc/dgcAckFailure/DGCAckFailure.java
test/java/rmi/dgc/dgcAckFailure/DGCAckFailure.java
+31
-6
未找到文件。
src/share/classes/sun/rmi/transport/DGCAckHandler.java
浏览文件 @
e68e60be
/*
* Copyright (c) 1996, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
6
, 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
...
...
@@ -118,6 +118,9 @@ public class DGCAckHandler {
if
(
objList
!=
null
&&
task
==
null
)
{
task
=
scheduler
.
schedule
(
new
Runnable
()
{
public
void
run
()
{
if
(
id
!=
null
)
{
idTable
.
remove
(
id
);
}
release
();
}
},
dgcAckTimeout
,
TimeUnit
.
MILLISECONDS
);
...
...
test/java/rmi/dgc/dgcAckFailure/DGCAckFailure.java
浏览文件 @
e68e60be
/*
* Copyright (c) 2001, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
6
, 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
...
...
@@ -22,7 +22,7 @@
*/
/* @test
* @bug 4017232
* @bug 4017232
8046339
* @summary If, after returning a reference to a remote object in the current
* VM (which gets implicitly converted to a remote stub), the client fails to
* both send a DGC dirty call and to send a "DGC acknowledgment", the RMI
...
...
@@ -36,10 +36,14 @@
import
java.io.*
;
import
java.net.*
;
import
java.lang.reflect.Field
;
import
java.lang.ref.*
;
import
java.rmi.*
;
import
java.rmi.server.*
;
import
java.util.Map
;
import
sun.rmi.transport.DGCAckHandler
;
interface
ReturnRemote
extends
Remote
{
Object
returnRemote
()
throws
RemoteException
;
...
...
@@ -48,6 +52,7 @@ interface ReturnRemote extends Remote {
public
class
DGCAckFailure
implements
ReturnRemote
{
private
static
final
long
TIMEOUT
=
20000
;
private
static
final
long
ACK_TIMEOUT
=
TIMEOUT
/
2
;
public
Object
returnRemote
()
{
return
new
Wrapper
(
this
);
...
...
@@ -55,7 +60,8 @@ public class DGCAckFailure implements ReturnRemote {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
System
.
setProperty
(
"sun.rmi.dgc.ackTimeout"
,
"10000"
);
System
.
setProperty
(
"sun.rmi.dgc.ackTimeout"
,
Long
.
toString
(
ACK_TIMEOUT
));
/*
* Set a socket factory that has a hook for shutting down all client
...
...
@@ -93,12 +99,31 @@ public class DGCAckFailure implements ReturnRemote {
break
;
}
}
if
(
ref
==
weakRef
)
{
System
.
err
.
println
(
"TEST PASSED"
);
}
else
{
if
(
ref
!=
weakRef
)
{
throw
new
RuntimeException
(
"TEST FAILED: "
+
"timed out, remote object not garbage collected"
);
}
// 8046339
// All DGCAckHandlers must be properly released after timeout
Thread
.
sleep
(
ACK_TIMEOUT
+
100
);
try
{
Field
field
=
DGCAckHandler
.
class
.
getDeclaredField
(
"idTable"
);
field
.
setAccessible
(
true
);
Object
obj
=
field
.
get
(
null
);
Map
<?,?>
idTable
=
(
Map
<?,?>)
obj
;
if
(!
idTable
.
isEmpty
())
{
throw
new
RuntimeException
(
"TEST FAILED: "
+
"DGCAckHandler.idTable isn't empty"
);
}
}
catch
(
ReflectiveOperationException
roe
)
{
throw
new
RuntimeException
(
roe
);
}
System
.
err
.
println
(
"TEST PASSED"
);
}
finally
{
try
{
UnicastRemoteObject
.
unexportObject
((
Remote
)
weakRef
.
get
(),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录