Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
7cdbb8b0
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看板
提交
7cdbb8b0
编写于
10月 20, 2016
作者:
R
robm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8165344: Update concurrency support
Reviewed-by: psandoz
上级
30fc9736
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
92 addition
and
4 deletion
+92
-4
src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
...ava/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
+27
-1
src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
...s/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
+38
-2
src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
...a/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
+27
-1
未找到文件。
src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
浏览文件 @
7cdbb8b0
...
...
@@ -40,6 +40,7 @@ import java.lang.reflect.Modifier;
import
java.security.AccessController
;
import
java.security.PrivilegedActionException
;
import
java.security.PrivilegedExceptionAction
;
import
java.util.Objects
;
import
java.util.function.IntBinaryOperator
;
import
java.util.function.IntUnaryOperator
;
import
sun.reflect.CallerSensitive
;
...
...
@@ -410,7 +411,17 @@ public abstract class AtomicIntegerFieldUpdater<T> {
if
(!
Modifier
.
isVolatile
(
modifiers
))
throw
new
IllegalArgumentException
(
"Must be volatile type"
);
this
.
cclass
=
(
Modifier
.
isProtected
(
modifiers
))
?
caller
:
tclass
;
// Access to protected field members is restricted to receivers only
// of the accessing class, or one of its subclasses, and the
// accessing class must in turn be a subclass (or package sibling)
// of the protected member's defining class.
// If the updater refers to a protected field of a declaring class
// outside the current package, the receiver argument will be
// narrowed to the type of the accessing class.
this
.
cclass
=
(
Modifier
.
isProtected
(
modifiers
)
&&
tclass
.
isAssignableFrom
(
caller
)
&&
!
isSamePackage
(
tclass
,
caller
))
?
caller
:
tclass
;
this
.
tclass
=
tclass
;
this
.
offset
=
U
.
objectFieldOffset
(
field
);
}
...
...
@@ -431,6 +442,21 @@ public abstract class AtomicIntegerFieldUpdater<T> {
return
false
;
}
/**
* Returns true if the two classes have the same class loader and
* package qualifier
*/
private
static
boolean
isSamePackage
(
Class
<?>
class1
,
Class
<?>
class2
)
{
return
class1
.
getClassLoader
()
==
class2
.
getClassLoader
()
&&
Objects
.
equals
(
getPackageName
(
class1
),
getPackageName
(
class2
));
}
private
static
String
getPackageName
(
Class
<?>
cls
)
{
String
cn
=
cls
.
getName
();
int
dot
=
cn
.
lastIndexOf
(
'.'
);
return
(
dot
!=
-
1
)
?
cn
.
substring
(
0
,
dot
)
:
""
;
}
/**
* Checks that target argument is instance of cclass. On
* failure, throws cause.
...
...
src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
浏览文件 @
7cdbb8b0
...
...
@@ -40,6 +40,7 @@ import java.lang.reflect.Modifier;
import
java.security.AccessController
;
import
java.security.PrivilegedActionException
;
import
java.security.PrivilegedExceptionAction
;
import
java.util.Objects
;
import
java.util.function.LongBinaryOperator
;
import
java.util.function.LongUnaryOperator
;
import
sun.reflect.CallerSensitive
;
...
...
@@ -408,7 +409,17 @@ public abstract class AtomicLongFieldUpdater<T> {
if
(!
Modifier
.
isVolatile
(
modifiers
))
throw
new
IllegalArgumentException
(
"Must be volatile type"
);
this
.
cclass
=
(
Modifier
.
isProtected
(
modifiers
))
?
caller
:
tclass
;
// Access to protected field members is restricted to receivers only
// of the accessing class, or one of its subclasses, and the
// accessing class must in turn be a subclass (or package sibling)
// of the protected member's defining class.
// If the updater refers to a protected field of a declaring class
// outside the current package, the receiver argument will be
// narrowed to the type of the accessing class.
this
.
cclass
=
(
Modifier
.
isProtected
(
modifiers
)
&&
tclass
.
isAssignableFrom
(
caller
)
&&
!
isSamePackage
(
tclass
,
caller
))
?
caller
:
tclass
;
this
.
tclass
=
tclass
;
this
.
offset
=
U
.
objectFieldOffset
(
field
);
}
...
...
@@ -539,7 +550,17 @@ public abstract class AtomicLongFieldUpdater<T> {
if
(!
Modifier
.
isVolatile
(
modifiers
))
throw
new
IllegalArgumentException
(
"Must be volatile type"
);
this
.
cclass
=
(
Modifier
.
isProtected
(
modifiers
))
?
caller
:
tclass
;
// Access to protected field members is restricted to receivers only
// of the accessing class, or one of its subclasses, and the
// accessing class must in turn be a subclass (or package sibling)
// of the protected member's defining class.
// If the updater refers to a protected field of a declaring class
// outside the current package, the receiver argument will be
// narrowed to the type of the accessing class.
this
.
cclass
=
(
Modifier
.
isProtected
(
modifiers
)
&&
tclass
.
isAssignableFrom
(
caller
)
&&
!
isSamePackage
(
tclass
,
caller
))
?
caller
:
tclass
;
this
.
tclass
=
tclass
;
this
.
offset
=
U
.
objectFieldOffset
(
field
);
}
...
...
@@ -620,4 +641,19 @@ public abstract class AtomicLongFieldUpdater<T> {
}
while
(
acl
!=
null
);
return
false
;
}
/**
* Returns true if the two classes have the same class loader and
* package qualifier
*/
private
static
boolean
isSamePackage
(
Class
<?>
class1
,
Class
<?>
class2
)
{
return
class1
.
getClassLoader
()
==
class2
.
getClassLoader
()
&&
Objects
.
equals
(
getPackageName
(
class1
),
getPackageName
(
class2
));
}
private
static
String
getPackageName
(
Class
<?>
cls
)
{
String
cn
=
cls
.
getName
();
int
dot
=
cn
.
lastIndexOf
(
'.'
);
return
(
dot
!=
-
1
)
?
cn
.
substring
(
0
,
dot
)
:
""
;
}
}
src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
浏览文件 @
7cdbb8b0
...
...
@@ -40,6 +40,7 @@ import java.lang.reflect.Modifier;
import
java.security.AccessController
;
import
java.security.PrivilegedActionException
;
import
java.security.PrivilegedExceptionAction
;
import
java.util.Objects
;
import
java.util.function.BinaryOperator
;
import
java.util.function.UnaryOperator
;
import
sun.reflect.CallerSensitive
;
...
...
@@ -346,7 +347,17 @@ public abstract class AtomicReferenceFieldUpdater<T,V> {
if
(!
Modifier
.
isVolatile
(
modifiers
))
throw
new
IllegalArgumentException
(
"Must be volatile type"
);
this
.
cclass
=
(
Modifier
.
isProtected
(
modifiers
))
?
caller
:
tclass
;
// Access to protected field members is restricted to receivers only
// of the accessing class, or one of its subclasses, and the
// accessing class must in turn be a subclass (or package sibling)
// of the protected member's defining class.
// If the updater refers to a protected field of a declaring class
// outside the current package, the receiver argument will be
// narrowed to the type of the accessing class.
this
.
cclass
=
(
Modifier
.
isProtected
(
modifiers
)
&&
tclass
.
isAssignableFrom
(
caller
)
&&
!
isSamePackage
(
tclass
,
caller
))
?
caller
:
tclass
;
this
.
tclass
=
tclass
;
this
.
vclass
=
vclass
;
this
.
offset
=
U
.
objectFieldOffset
(
field
);
...
...
@@ -368,6 +379,21 @@ public abstract class AtomicReferenceFieldUpdater<T,V> {
return
false
;
}
/**
* Returns true if the two classes have the same class loader and
* package qualifier
*/
private
static
boolean
isSamePackage
(
Class
<?>
class1
,
Class
<?>
class2
)
{
return
class1
.
getClassLoader
()
==
class2
.
getClassLoader
()
&&
Objects
.
equals
(
getPackageName
(
class1
),
getPackageName
(
class2
));
}
private
static
String
getPackageName
(
Class
<?>
cls
)
{
String
cn
=
cls
.
getName
();
int
dot
=
cn
.
lastIndexOf
(
'.'
);
return
(
dot
!=
-
1
)
?
cn
.
substring
(
0
,
dot
)
:
""
;
}
/**
* Checks that target argument is instance of cclass. On
* failure, throws cause.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录