Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
c7514743
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看板
提交
c7514743
编写于
6月 13, 2013
作者:
W
weijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8013739: Better LDAP resource management
Reviewed-by: ahgross, mchung, xuelei
上级
61f17936
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
44 addition
and
7 deletion
+44
-7
src/share/classes/com/sun/jndi/ldap/VersionHelper12.java
src/share/classes/com/sun/jndi/ldap/VersionHelper12.java
+10
-5
src/share/classes/java/lang/System.java
src/share/classes/java/lang/System.java
+4
-0
src/share/classes/java/lang/Thread.java
src/share/classes/java/lang/Thread.java
+22
-2
src/share/classes/sun/misc/JavaLangAccess.java
src/share/classes/sun/misc/JavaLangAccess.java
+8
-0
未找到文件。
src/share/classes/com/sun/jndi/ldap/VersionHelper12.java
浏览文件 @
c7514743
...
...
@@ -25,11 +25,12 @@
package
com.sun.jndi.ldap
;
import
java.net.URL
;
import
java.net.URLClassLoader
;
import
java.net.MalformedURLException
;
import
java.security.AccessControlContext
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
sun.misc.SharedSecrets
;
final
class
VersionHelper12
extends
VersionHelper
{
...
...
@@ -82,12 +83,16 @@ final class VersionHelper12 extends VersionHelper {
}
Thread
createThread
(
final
Runnable
r
)
{
final
AccessControlContext
acc
=
AccessController
.
getContext
();
// 4290486: doPrivileged is needed to create a thread in
// an environment that restricts "modifyThreadGroup".
return
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Thread
>()
{
public
Thread
run
()
{
return
new
Thread
(
r
);
new
PrivilegedAction
<
Thread
>()
{
public
Thread
run
()
{
return
SharedSecrets
.
getJavaLangAccess
()
.
newThreadWithAcc
(
r
,
acc
);
}
}
}
);
}
}
src/share/classes/java/lang/System.java
浏览文件 @
c7514743
...
...
@@ -26,6 +26,7 @@ package java.lang;
import
java.io.*
;
import
java.lang.reflect.Executable
;
import
java.security.AccessControlContext
;
import
java.util.Properties
;
import
java.util.PropertyPermission
;
import
java.util.StringTokenizer
;
...
...
@@ -1251,6 +1252,9 @@ public final class System {
public
String
newStringUnsafe
(
char
[]
chars
)
{
return
new
String
(
chars
,
true
);
}
public
Thread
newThreadWithAcc
(
Runnable
target
,
AccessControlContext
acc
)
{
return
new
Thread
(
target
,
acc
);
}
});
}
}
src/share/classes/java/lang/Thread.java
浏览文件 @
c7514743
...
...
@@ -340,6 +340,15 @@ class Thread implements Runnable {
sleep
(
millis
);
}
/**
* Initializes a Thread with the current AccessControlContext.
* @see #init(ThreadGroup,Runnable,String,long,AccessControlContext)
*/
private
void
init
(
ThreadGroup
g
,
Runnable
target
,
String
name
,
long
stackSize
)
{
init
(
g
,
target
,
name
,
stackSize
,
null
);
}
/**
* Initializes a Thread.
*
...
...
@@ -348,9 +357,11 @@ class Thread implements Runnable {
* @param name the name of the new Thread
* @param stackSize the desired stack size for the new thread, or
* zero to indicate that this parameter is to be ignored.
* @param acc the AccessControlContext to inherit, or
* AccessController.getContext() if null
*/
private
void
init
(
ThreadGroup
g
,
Runnable
target
,
String
name
,
long
stackSize
)
{
long
stackSize
,
AccessControlContext
acc
)
{
if
(
name
==
null
)
{
throw
new
NullPointerException
(
"name cannot be null"
);
}
...
...
@@ -396,7 +407,8 @@ class Thread implements Runnable {
this
.
contextClassLoader
=
parent
.
getContextClassLoader
();
else
this
.
contextClassLoader
=
parent
.
contextClassLoader
;
this
.
inheritedAccessControlContext
=
AccessController
.
getContext
();
this
.
inheritedAccessControlContext
=
acc
!=
null
?
acc
:
AccessController
.
getContext
();
this
.
target
=
target
;
setPriority
(
priority
);
if
(
parent
.
inheritableThreadLocals
!=
null
)
...
...
@@ -448,6 +460,14 @@ class Thread implements Runnable {
init
(
null
,
target
,
"Thread-"
+
nextThreadNum
(),
0
);
}
/**
* Creates a new Thread that inherits the given AccessControlContext.
* This is not a public constructor.
*/
Thread
(
Runnable
target
,
AccessControlContext
acc
)
{
init
(
null
,
target
,
"Thread-"
+
nextThreadNum
(),
0
,
acc
);
}
/**
* Allocates a new {@code Thread} object. This constructor has the same
* effect as {@linkplain #Thread(ThreadGroup,Runnable,String) Thread}
...
...
src/share/classes/sun/misc/JavaLangAccess.java
浏览文件 @
c7514743
...
...
@@ -27,6 +27,8 @@ package sun.misc;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Executable
;
import
java.security.AccessControlContext
;
import
sun.reflect.ConstantPool
;
import
sun.reflect.annotation.AnnotationType
;
import
sun.nio.ch.Interruptible
;
...
...
@@ -107,4 +109,10 @@ public interface JavaLangAccess {
* @return a newly created string whose content is the character array
*/
String
newStringUnsafe
(
char
[]
chars
);
/**
* Returns a new Thread with the given Runnable and an
* inherited AccessControlContext.
*/
Thread
newThreadWithAcc
(
Runnable
target
,
AccessControlContext
acc
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录