Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
632a610d
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看板
提交
632a610d
编写于
8月 20, 2009
作者:
V
valeriep
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6636650: (cl) Resurrected ClassLoaders can still have children
Summary: Prevent classloader from resurrection Reviewed-by: hawtin
上级
a09ca6db
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
58 deletion
+27
-58
src/share/classes/java/lang/ClassLoader.java
src/share/classes/java/lang/ClassLoader.java
+27
-58
未找到文件。
src/share/classes/java/lang/ClassLoader.java
浏览文件 @
632a610d
...
...
@@ -186,11 +186,6 @@ public abstract class ClassLoader {
parallelLoaders
.
add
(
ClassLoader
.
class
);
}
// If initialization succeed this is set to true and security checks will
// succeed. Otherwise the object is not initialized and the object is
// useless.
private
final
boolean
initialized
;
// The parent class loader for delegation
// Note: VM hardcoded the offset of this field, thus all new fields
// must be added *after* it.
...
...
@@ -232,6 +227,31 @@ public abstract class ClassLoader {
private
final
HashMap
<
String
,
Package
>
packages
=
new
HashMap
<
String
,
Package
>();
private
static
Void
checkCreateClassLoader
()
{
SecurityManager
security
=
System
.
getSecurityManager
();
if
(
security
!=
null
)
{
security
.
checkCreateClassLoader
();
}
return
null
;
}
private
ClassLoader
(
Void
unused
,
ClassLoader
parent
)
{
this
.
parent
=
parent
;
if
(
parallelLoaders
.
contains
(
this
.
getClass
()))
{
parallelLockMap
=
new
ConcurrentHashMap
<
String
,
Object
>();
package2certs
=
new
ConcurrentHashMap
<
String
,
Certificate
[]>();
domains
=
Collections
.
synchronizedSet
(
new
HashSet
<
ProtectionDomain
>());
assertionLock
=
new
Object
();
}
else
{
// no finer-grained lock; lock on the classloader instance
parallelLockMap
=
null
;
package2certs
=
new
Hashtable
<
String
,
Certificate
[]>();
domains
=
new
HashSet
<
ProtectionDomain
>();
assertionLock
=
this
;
}
}
/**
* Creates a new class loader using the specified parent class loader for
* delegation.
...
...
@@ -252,25 +272,7 @@ public abstract class ClassLoader {
* @since 1.2
*/
protected
ClassLoader
(
ClassLoader
parent
)
{
SecurityManager
security
=
System
.
getSecurityManager
();
if
(
security
!=
null
)
{
security
.
checkCreateClassLoader
();
}
this
.
parent
=
parent
;
if
(
parallelLoaders
.
contains
(
this
.
getClass
()))
{
parallelLockMap
=
new
ConcurrentHashMap
<
String
,
Object
>();
package2certs
=
new
ConcurrentHashMap
<
String
,
Certificate
[]>();
domains
=
Collections
.
synchronizedSet
(
new
HashSet
<
ProtectionDomain
>());
assertionLock
=
new
Object
();
}
else
{
// no finer-grained lock; lock on the classloader instance
parallelLockMap
=
null
;
package2certs
=
new
Hashtable
<
String
,
Certificate
[]>();
domains
=
new
HashSet
<
ProtectionDomain
>();
assertionLock
=
this
;
}
initialized
=
true
;
this
(
checkCreateClassLoader
(),
parent
);
}
/**
...
...
@@ -289,25 +291,7 @@ public abstract class ClassLoader {
* of a new class loader.
*/
protected
ClassLoader
()
{
SecurityManager
security
=
System
.
getSecurityManager
();
if
(
security
!=
null
)
{
security
.
checkCreateClassLoader
();
}
this
.
parent
=
getSystemClassLoader
();
if
(
parallelLoaders
.
contains
(
this
.
getClass
()))
{
parallelLockMap
=
new
ConcurrentHashMap
<
String
,
Object
>();
package2certs
=
new
ConcurrentHashMap
<
String
,
Certificate
[]>();
domains
=
Collections
.
synchronizedSet
(
new
HashSet
<
ProtectionDomain
>());
assertionLock
=
new
Object
();
}
else
{
// no finer-grained lock; lock on the classloader instance
parallelLockMap
=
null
;
package2certs
=
new
Hashtable
<
String
,
Certificate
[]>();
domains
=
new
HashSet
<
ProtectionDomain
>();
assertionLock
=
this
;
}
initialized
=
true
;
this
(
checkCreateClassLoader
(),
getSystemClassLoader
());
}
// -- Class --
...
...
@@ -742,7 +726,6 @@ public abstract class ClassLoader {
ProtectionDomain
protectionDomain
)
throws
ClassFormatError
{
check
();
protectionDomain
=
preDefineClass
(
name
,
protectionDomain
);
Class
c
=
null
;
...
...
@@ -826,8 +809,6 @@ public abstract class ClassLoader {
ProtectionDomain
protectionDomain
)
throws
ClassFormatError
{
check
();
int
len
=
b
.
remaining
();
// Use byte[] if not a direct ByteBufer:
...
...
@@ -972,7 +953,6 @@ public abstract class ClassLoader {
* @see #defineClass(String, byte[], int, int)
*/
protected
final
void
resolveClass
(
Class
<?>
c
)
{
check
();
resolveClass0
(
c
);
}
...
...
@@ -1003,7 +983,6 @@ public abstract class ClassLoader {
protected
final
Class
<?>
findSystemClass
(
String
name
)
throws
ClassNotFoundException
{
check
();
ClassLoader
system
=
getSystemClassLoader
();
if
(
system
==
null
)
{
if
(!
checkName
(
name
))
...
...
@@ -1016,7 +995,6 @@ public abstract class ClassLoader {
private
Class
findBootstrapClass0
(
String
name
)
throws
ClassNotFoundException
{
check
();
if
(!
checkName
(
name
))
throw
new
ClassNotFoundException
(
name
);
return
findBootstrapClass
(
name
);
...
...
@@ -1025,13 +1003,6 @@ public abstract class ClassLoader {
private
native
Class
findBootstrapClass
(
String
name
)
throws
ClassNotFoundException
;
// Check to make sure the class loader has been initialized.
private
void
check
()
{
if
(!
initialized
)
{
throw
new
SecurityException
(
"ClassLoader object not initialized"
);
}
}
/**
* Returns the class with the given <a href="#name">binary name</a> if this
* loader has been recorded by the Java virtual machine as an initiating
...
...
@@ -1047,7 +1018,6 @@ public abstract class ClassLoader {
* @since 1.1
*/
protected
final
Class
<?>
findLoadedClass
(
String
name
)
{
check
();
if
(!
checkName
(
name
))
return
null
;
return
findLoadedClass0
(
name
);
...
...
@@ -1068,7 +1038,6 @@ public abstract class ClassLoader {
* @since 1.1
*/
protected
final
void
setSigners
(
Class
<?>
c
,
Object
[]
signers
)
{
check
();
c
.
setSigners
(
signers
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录