Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
da8af369
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看板
提交
da8af369
编写于
9月 14, 2012
作者:
M
mchung
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7193302: Remove ConstructorProperties annotation from java.lang.management.LockInfo
Reviewed-by: alanb, sla, egahlin
上级
40192a8b
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
193 addition
and
66 deletion
+193
-66
src/share/classes/java/lang/management/LockInfo.java
src/share/classes/java/lang/management/LockInfo.java
+46
-4
src/share/classes/java/lang/management/ThreadInfo.java
src/share/classes/java/lang/management/ThreadInfo.java
+2
-8
src/share/classes/sun/management/LockDataConverterMXBean.java
...share/classes/sun/management/LockDataConverterMXBean.java
+0
-40
src/share/classes/sun/management/LockInfoCompositeData.java
src/share/classes/sun/management/LockInfoCompositeData.java
+118
-0
src/share/classes/sun/management/MappedMXBeanType.java
src/share/classes/sun/management/MappedMXBeanType.java
+1
-1
src/share/classes/sun/management/MonitorInfoCompositeData.java
...hare/classes/sun/management/MonitorInfoCompositeData.java
+1
-1
src/share/classes/sun/management/ThreadInfoCompositeData.java
...share/classes/sun/management/ThreadInfoCompositeData.java
+20
-11
test/java/lang/management/ManagementFactory/ThreadMXBeanProxy.java
.../lang/management/ManagementFactory/ThreadMXBeanProxy.java
+5
-1
未找到文件。
src/share/classes/java/lang/management/LockInfo.java
浏览文件 @
da8af369
...
...
@@ -27,7 +27,7 @@ package java.lang.management;
import
javax.management.openmbean.CompositeData
;
import
java.util.concurrent.locks.*
;
import
java.beans.ConstructorProperties
;
import
sun.management.LockInfoCompositeData
;
/**
* Information about a <em>lock</em>. A lock can be a built-in object monitor,
...
...
@@ -44,8 +44,7 @@ import java.beans.ConstructorProperties;
*
* <h4><a name="MappedType">MXBean Mapping</a></h4>
* <tt>LockInfo</tt> is mapped to a {@link CompositeData CompositeData}
* as specified in the <a href="../../../javax/management/MXBean.html#mapping-rules">
* type mapping rules</a> of {@linkplain javax.management.MXBean MXBeans}.
* as specified in the {@link #from from} method.
*
* @see java.util.concurrent.locks.AbstractOwnableSynchronizer
* @see java.util.concurrent.locks.Condition
...
...
@@ -66,7 +65,6 @@ public class LockInfo {
* @param identityHashCode the {@link System#identityHashCode
* identity hash code} of the lock object.
*/
@ConstructorProperties
({
"className"
,
"identityHashCode"
})
public
LockInfo
(
String
className
,
int
identityHashCode
)
{
if
(
className
==
null
)
{
throw
new
NullPointerException
(
"Parameter className cannot be null"
);
...
...
@@ -102,6 +100,50 @@ public class LockInfo {
return
identityHashCode
;
}
/**
* Returns a {@code LockInfo} object represented by the
* given {@code CompositeData}.
* The given {@code CompositeData} must contain the following attributes:
* <blockquote>
* <table border>
* <tr>
* <th align=left>Attribute Name</th>
* <th align=left>Type</th>
* </tr>
* <tr>
* <td>className</td>
* <td><tt>java.lang.String</tt></td>
* </tr>
* <tr>
* <td>identityHashCode</td>
* <td><tt>java.lang.Integer</tt></td>
* </tr>
* </table>
* </blockquote>
*
* @param cd {@code CompositeData} representing a {@code LockInfo}
*
* @throws IllegalArgumentException if {@code cd} does not
* represent a {@code LockInfo} with the attributes described
* above.
* @return a {@code LockInfo} object represented
* by {@code cd} if {@code cd} is not {@code null};
* {@code null} otherwise.
*
* @since 1.8
*/
public
static
LockInfo
from
(
CompositeData
cd
)
{
if
(
cd
==
null
)
{
return
null
;
}
if
(
cd
instanceof
LockInfoCompositeData
)
{
return
((
LockInfoCompositeData
)
cd
).
getLockInfo
();
}
else
{
return
LockInfoCompositeData
.
toLockInfo
(
cd
);
}
}
/**
* Returns a string representation of a lock. The returned
* string representation consists of the name of the class of the
...
...
src/share/classes/java/lang/management/ThreadInfo.java
浏览文件 @
da8af369
...
...
@@ -696,9 +696,7 @@ public class ThreadInfo {
* <td>lockInfo</td>
* <td><tt>javax.management.openmbean.CompositeData</tt>
* - the mapped type for {@link LockInfo} as specified in the
* <a href="../../../javax/management/MXBean.html#mapping-rules">
* type mapping rules</a> of
* {@linkplain javax.management.MXBean MXBeans}.
* {@link LockInfo#from} method.
* <p>
* If <tt>cd</tt> does not contain this attribute,
* the <tt>LockInfo</tt> object will be constructed from
...
...
@@ -766,10 +764,7 @@ public class ThreadInfo {
* <td>lockedSynchronizers</td>
* <td><tt>javax.management.openmbean.CompositeData[]</tt>
* whose element type is the mapped type for
* {@link LockInfo} as specified in the
* <a href="../../../javax/management/MXBean.html#mapping-rules">
* type mapping rules</a> of
* {@linkplain javax.management.MXBean MXBeans}.
* {@link LockInfo} as specified in the {@link LockInfo#from} method.
* <p>
* If <tt>cd</tt> does not contain this attribute,
* this attribute will be set to an empty array. </td>
...
...
@@ -830,7 +825,6 @@ public class ThreadInfo {
* @since 1.6
*/
public
LockInfo
[]
getLockedSynchronizers
()
{
// represents an <a href="LockInfo.html#OwnableSynchronizer">
return
lockedSynchronizers
;
}
...
...
src/share/classes/sun/management/LockDataConverterMXBean.java
已删除
100644 → 0
浏览文件 @
40192a8b
/*
* Copyright (c) 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
sun.management
;
import
java.lang.management.LockInfo
;
/**
* This interface is used for data conversion from LockInfo
* to CompositeData (its mapped type) or vice versa.
*/
public
interface
LockDataConverterMXBean
{
public
void
setLockInfo
(
LockInfo
l
);
public
LockInfo
getLockInfo
();
public
void
setLockedSynchronizers
(
LockInfo
[]
l
);
public
LockInfo
[]
getLockedSynchronizers
();
}
src/share/classes/sun/management/Lock
DataConverter
.java
→
src/share/classes/sun/management/Lock
InfoCompositeData
.java
浏览文件 @
da8af369
/*
* Copyright (c) 20
05, 2008
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 20
12
, 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
...
...
@@ -26,86 +26,93 @@
package
sun.management
;
import
java.lang.management.LockInfo
;
import
java.lang.management.ThreadInfo
;
import
javax.management.Attribute
;
import
javax.management.StandardMBean
;
import
javax.management.openmbean.CompositeType
;
import
javax.management.openmbean.CompositeData
;
import
javax.management.openmbean.CompositeDataSupport
;
import
javax.management.openmbean.OpenDataException
;
/**
* This MXBean is used for data conversion from LockInfo
* to CompositeData (its mapped type) or vice versa.
* A CompositeData for LockInfo for the local management support.
* This class avoids the performance penalty paid to the
* construction of a CompositeData use in the local case.
*/
class
LockDataConverter
extends
StandardMBean
implements
LockDataConverterMXBean
{
private
LockInfo
lockInfo
;
private
LockInfo
[]
lockedSyncs
;
LockDataConverter
()
{
super
(
LockDataConverterMXBean
.
class
,
true
);
this
.
lockInfo
=
null
;
this
.
lockedSyncs
=
null
;
}
LockDataConverter
(
ThreadInfo
ti
)
{
super
(
LockDataConverterMXBean
.
class
,
true
);
this
.
lockInfo
=
ti
.
getLockInfo
();
this
.
lockedSyncs
=
ti
.
getLockedSynchronizers
();
}
public
class
LockInfoCompositeData
extends
LazyCompositeData
{
private
final
LockInfo
lock
;
p
ublic
void
setLockInfo
(
LockInfo
l
)
{
this
.
lock
Info
=
l
;
p
rivate
LockInfoCompositeData
(
LockInfo
li
)
{
this
.
lock
=
li
;
}
public
LockInfo
getLockInfo
()
{
return
this
.
lockInfo
;
return
lock
;
}
public
void
setLockedSynchronizers
(
LockInfo
[]
l
)
{
this
.
lockedSyncs
=
l
;
}
public
static
CompositeData
toCompositeData
(
LockInfo
li
)
{
if
(
li
==
null
)
{
return
null
;
}
public
LockInfo
[]
getLockedSynchronizers
()
{
return
this
.
lockedSyncs
;
LockInfoCompositeData
licd
=
new
LockInfoCompositeData
(
li
);
return
licd
.
getCompositeData
()
;
}
// helper methods
CompositeData
toLockInfoCompositeData
()
{
protected
CompositeData
getCompositeData
()
{
// CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
// lockInfoItemNames!
final
Object
[]
lockInfoItemValues
=
{
new
String
(
lock
.
getClassName
()),
new
Integer
(
lock
.
getIdentityHashCode
()),
};
try
{
return
(
CompositeData
)
getAttribute
(
"LockInfo"
);
}
catch
(
Exception
e
)
{
throw
new
AssertionError
(
e
);
return
new
CompositeDataSupport
(
lockInfoCompositeType
,
lockInfoItemNames
,
lockInfoItemValues
);
}
catch
(
OpenDataException
e
)
{
// Should never reach here
throw
Util
.
newException
(
e
);
}
}
CompositeData
[]
toLockedSynchronizersCompositeData
()
{
private
static
final
CompositeType
lockInfoCompositeType
;
static
{
try
{
return
(
CompositeData
[])
getAttribute
(
"LockedSynchronizers"
);
}
catch
(
Exception
e
)
{
throw
new
AssertionError
(
e
);
lockInfoCompositeType
=
(
CompositeType
)
MappedMXBeanType
.
toOpenType
(
LockInfo
.
class
);
}
catch
(
OpenDataException
e
)
{
// Should never reach here
throw
Util
.
newException
(
e
);
}
}
LockInfo
toLockInfo
(
CompositeData
cd
)
{
try
{
setAttribute
(
new
Attribute
(
"LockInfo"
,
cd
));
}
catch
(
Exception
e
)
{
throw
new
AssertionError
(
e
);
}
return
getLockInfo
();
static
CompositeType
getLockInfoCompositeType
()
{
return
lockInfoCompositeType
;
}
LockInfo
[]
toLockedSynchronizers
(
CompositeData
[]
cd
)
{
try
{
setAttribute
(
new
Attribute
(
"LockedSynchronizers"
,
cd
));
}
catch
(
Exception
e
)
{
throw
new
AssertionError
(
e
);
private
static
final
String
CLASS_NAME
=
"className"
;
private
static
final
String
IDENTITY_HASH_CODE
=
"identityHashCode"
;
private
static
final
String
[]
lockInfoItemNames
=
{
CLASS_NAME
,
IDENTITY_HASH_CODE
,
};
/*
* Returns a LockInfo object mapped from the given CompositeData.
*/
public
static
LockInfo
toLockInfo
(
CompositeData
cd
)
{
if
(
cd
==
null
)
{
throw
new
NullPointerException
(
"Null CompositeData"
);
}
return
getLockedSynchronizers
();
}
static
CompositeData
toLockInfoCompositeData
(
LockInfo
l
)
{
LockDataConverter
ldc
=
new
LockDataConverter
();
ldc
.
setLockInfo
(
l
);
return
ldc
.
toLockInfoCompositeData
();
if
(!
isTypeMatched
(
lockInfoCompositeType
,
cd
.
getCompositeType
()))
{
throw
new
IllegalArgumentException
(
"Unexpected composite type for LockInfo"
);
}
String
className
=
getString
(
cd
,
CLASS_NAME
);
int
identityHashCode
=
getInt
(
cd
,
IDENTITY_HASH_CODE
);
return
new
LockInfo
(
className
,
identityHashCode
);
}
private
static
final
long
serialVersionUID
=
-
6374759159749014052L
;
}
src/share/classes/sun/management/MappedMXBeanType.java
浏览文件 @
da8af369
...
...
@@ -703,7 +703,7 @@ public abstract class MappedMXBeanType {
if
(
data
instanceof
java
.
lang
.
management
.
MonitorInfo
)
{
return
MonitorInfoCompositeData
.
toCompositeData
((
MonitorInfo
)
data
);
}
return
Lock
DataConverter
.
toLockInf
oCompositeData
((
LockInfo
)
data
);
return
Lock
InfoCompositeData
.
t
oCompositeData
((
LockInfo
)
data
);
}
if
(
data
instanceof
MemoryNotificationInfo
)
{
...
...
src/share/classes/sun/management/MonitorInfoCompositeData.java
浏览文件 @
da8af369
...
...
@@ -59,7 +59,7 @@ public class MonitorInfoCompositeData extends LazyCompositeData {
int
len
=
monitorInfoItemNames
.
length
;
Object
[]
values
=
new
Object
[
len
];
CompositeData
li
=
Lock
DataConverter
.
toLockInf
oCompositeData
(
lock
);
CompositeData
li
=
Lock
InfoCompositeData
.
t
oCompositeData
(
lock
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
String
item
=
monitorInfoItemNames
[
i
];
...
...
src/share/classes/sun/management/ThreadInfoCompositeData.java
浏览文件 @
da8af369
...
...
@@ -85,11 +85,18 @@ public class ThreadInfoCompositeData extends LazyCompositeData {
}
// Convert MonitorInfo[] and LockInfo[] to CompositeData[]
LockDataConverter
converter
=
new
LockDataConverter
(
threadInfo
);
CompositeData
lockInfoData
=
converter
.
toLockInfoCompositeData
();
CompositeData
[]
lockedSyncsData
=
converter
.
toLockedSynchronizersCompositeData
();
CompositeData
lockInfoData
=
LockInfoCompositeData
.
toCompositeData
(
threadInfo
.
getLockInfo
());
// Convert LockInfo[] and MonitorInfo[] to CompositeData[]
LockInfo
[]
lockedSyncs
=
threadInfo
.
getLockedSynchronizers
();
CompositeData
[]
lockedSyncsData
=
new
CompositeData
[
lockedSyncs
.
length
];
for
(
int
i
=
0
;
i
<
lockedSyncs
.
length
;
i
++)
{
LockInfo
li
=
lockedSyncs
[
i
];
lockedSyncsData
[
i
]
=
LockInfoCompositeData
.
toCompositeData
(
li
);
}
// Convert MonitorInfo[] to CompositeData[]
MonitorInfo
[]
lockedMonitors
=
threadInfo
.
getLockedMonitors
();
CompositeData
[]
lockedMonitorsData
=
new
CompositeData
[
lockedMonitors
.
length
];
...
...
@@ -98,7 +105,6 @@ public class ThreadInfoCompositeData extends LazyCompositeData {
lockedMonitorsData
[
i
]
=
MonitorInfoCompositeData
.
toCompositeData
(
mi
);
}
// CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
// threadInfoItemNames!
final
Object
[]
threadInfoItemValues
=
{
...
...
@@ -216,11 +222,11 @@ public class ThreadInfoCompositeData extends LazyCompositeData {
// with it. So we can get the CompositeType representing LockInfo
// from a mapped CompositeData for any LockInfo object.
// Thus we construct a random LockInfo object and pass it
// to Lock
DataConverter
to do the conversion.
// to Lock
InfoCompositeData
to do the conversion.
Object
o
=
new
Object
();
LockInfo
li
=
new
LockInfo
(
o
.
getClass
().
getName
(),
System
.
identityHashCode
(
o
));
CompositeData
cd
=
Lock
DataConverter
.
toLockInf
oCompositeData
(
li
);
CompositeData
cd
=
Lock
InfoCompositeData
.
t
oCompositeData
(
li
);
lockInfoCompositeType
=
cd
.
getCompositeType
();
}
...
...
@@ -315,9 +321,8 @@ public class ThreadInfoCompositeData extends LazyCompositeData {
// 6.0 new attributes
public
LockInfo
lockInfo
()
{
LockDataConverter
converter
=
new
LockDataConverter
();
CompositeData
lockInfoData
=
(
CompositeData
)
cdata
.
get
(
LOCK_INFO
);
return
converter
.
toLockInfo
(
lockInfoData
);
return
LockInfo
.
from
(
lockInfoData
);
}
public
MonitorInfo
[]
lockedMonitors
()
{
...
...
@@ -336,13 +341,17 @@ public class ThreadInfoCompositeData extends LazyCompositeData {
}
public
LockInfo
[]
lockedSynchronizers
()
{
LockDataConverter
converter
=
new
LockDataConverter
();
CompositeData
[]
lockedSyncsData
=
(
CompositeData
[])
cdata
.
get
(
LOCKED_SYNCS
);
// The LockedSynchronizers item cannot be null, but if it is we will
// get a NullPointerException when we ask for its length.
return
converter
.
toLockedSynchronizers
(
lockedSyncsData
);
LockInfo
[]
locks
=
new
LockInfo
[
lockedSyncsData
.
length
];
for
(
int
i
=
0
;
i
<
lockedSyncsData
.
length
;
i
++)
{
CompositeData
cdi
=
lockedSyncsData
[
i
];
locks
[
i
]
=
LockInfo
.
from
(
cdi
);
}
return
locks
;
}
/** Validate if the input CompositeData has the expected
...
...
test/java/lang/management/ManagementFactory/ThreadMXBeanProxy.java
浏览文件 @
da8af369
...
...
@@ -23,7 +23,7 @@
/*
* @test
* @bug 5086470 6358247
* @bug 5086470 6358247
7193302
* @summary Test type conversion when invoking ThreadMXBean.dumpAllThreads
* through proxy.
*
...
...
@@ -173,6 +173,10 @@ public class ThreadMXBeanProxy {
throw
new
RuntimeException
(
"LockInfo: "
+
syncs
[
0
]
+
" IdentityHashCode not matched. Expected: "
+
hcode
);
}
LockInfo
li
=
info
.
getLockInfo
();
if
(
li
==
null
)
{
throw
new
RuntimeException
(
"Expected non-null LockInfo"
);
}
}
}
static
class
Mutex
implements
Lock
,
java
.
io
.
Serializable
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录