Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
1dab318d
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看板
提交
1dab318d
编写于
3月 27, 2008
作者:
T
tbell
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
42811879
97b7d277
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
192 addition
and
23 deletion
+192
-23
src/share/classes/com/sun/jmx/mbeanserver/OpenConverter.java
src/share/classes/com/sun/jmx/mbeanserver/OpenConverter.java
+6
-6
src/share/classes/com/sun/management/package.html
src/share/classes/com/sun/management/package.html
+1
-1
src/share/classes/java/beans/MetaData.java
src/share/classes/java/beans/MetaData.java
+3
-3
src/share/classes/javax/management/MBeanServer.java
src/share/classes/javax/management/MBeanServer.java
+32
-8
src/share/classes/javax/management/modelmbean/RequiredModelMBean.java
...asses/javax/management/modelmbean/RequiredModelMBean.java
+6
-4
src/share/classes/sun/management/Flag.java
src/share/classes/sun/management/Flag.java
+2
-1
test/com/sun/management/HotSpotDiagnosticMXBean/GetDiagnosticOptions.java
...agement/HotSpotDiagnosticMXBean/GetDiagnosticOptions.java
+61
-0
test/javax/management/modelmbean/LoggingExceptionTest.java
test/javax/management/modelmbean/LoggingExceptionTest.java
+81
-0
未找到文件。
src/share/classes/com/sun/jmx/mbeanserver/OpenConverter.java
浏览文件 @
1dab318d
...
...
@@ -1118,11 +1118,11 @@ public abstract class OpenConverter {
final
Class
<
ConstructorProperties
>
propertyNamesClass
=
ConstructorProperties
.
class
;
Class
targetClass
=
getTargetClass
();
Constructor
[]
constrs
=
targetClass
.
getConstructors
();
Constructor
<?>
[]
constrs
=
targetClass
.
getConstructors
();
// Applicable if and only if there are any annotated constructors
List
<
Constructor
>
annotatedConstrList
=
newList
();
for
(
Constructor
constr
:
constrs
)
{
List
<
Constructor
<?>
>
annotatedConstrList
=
newList
();
for
(
Constructor
<?>
constr
:
constrs
)
{
if
(
Modifier
.
isPublic
(
constr
.
getModifiers
())
&&
constr
.
getAnnotation
(
propertyNamesClass
)
!=
null
)
annotatedConstrList
.
add
(
constr
);
...
...
@@ -1152,7 +1152,7 @@ public abstract class OpenConverter {
// Also remember the set of properties in that constructor
// so we can test unambiguity.
Set
<
BitSet
>
getterIndexSets
=
newSet
();
for
(
Constructor
constr
:
annotatedConstrList
)
{
for
(
Constructor
<?>
constr
:
annotatedConstrList
)
{
String
[]
propertyNames
=
constr
.
getAnnotation
(
propertyNamesClass
).
value
();
...
...
@@ -1309,10 +1309,10 @@ public abstract class OpenConverter {
}
private
static
class
Constr
{
final
Constructor
constructor
;
final
Constructor
<?>
constructor
;
final
int
[]
paramIndexes
;
final
BitSet
presentParams
;
Constr
(
Constructor
constructor
,
int
[]
paramIndexes
,
Constr
(
Constructor
<?>
constructor
,
int
[]
paramIndexes
,
BitSet
presentParams
)
{
this
.
constructor
=
constructor
;
this
.
paramIndexes
=
paramIndexes
;
...
...
src/share/classes/com/sun/management/package.html
浏览文件 @
1dab318d
CTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!DO
CTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
...
...
src/share/classes/java/beans/MetaData.java
浏览文件 @
1dab318d
...
...
@@ -1553,7 +1553,7 @@ class MetaData {
private
static
String
[]
getConstructorProperties
(
Class
type
)
{
String
[]
names
=
null
;
int
length
=
0
;
for
(
Constructor
constructor
:
type
.
getConstructors
())
{
for
(
Constructor
<?>
constructor
:
type
.
getConstructors
())
{
String
[]
value
=
getAnnotationValue
(
constructor
);
if
((
value
!=
null
)
&&
(
length
<
value
.
length
)
&&
isValid
(
constructor
,
value
))
{
names
=
value
;
...
...
@@ -1563,14 +1563,14 @@ class MetaData {
return
names
;
}
private
static
String
[]
getAnnotationValue
(
Constructor
constructor
)
{
private
static
String
[]
getAnnotationValue
(
Constructor
<?>
constructor
)
{
ConstructorProperties
annotation
=
constructor
.
getAnnotation
(
ConstructorProperties
.
class
);
return
(
annotation
!=
null
)
?
annotation
.
value
()
:
null
;
}
private
static
boolean
isValid
(
Constructor
constructor
,
String
[]
names
)
{
private
static
boolean
isValid
(
Constructor
<?>
constructor
,
String
[]
names
)
{
Class
[]
parameters
=
constructor
.
getParameterTypes
();
if
(
names
.
length
!=
parameters
.
length
)
{
return
false
;
...
...
src/share/classes/javax/management/MBeanServer.java
浏览文件 @
1dab318d
...
...
@@ -50,7 +50,7 @@ import javax.management.loading.ClassLoaderRepository;
* server. A Java object cannot be registered in the MBean server
* unless it is a JMX compliant MBean.</p>
*
* <p>When an MBean is registered or unregistered in the MBean server
* <p
id="notif"
>When an MBean is registered or unregistered in the MBean server
* a {@link javax.management.MBeanServerNotification
* MBeanServerNotification} Notification is emitted. To register an
* object as listener to MBeanServerNotifications you should call the
...
...
@@ -258,27 +258,43 @@ import javax.management.loading.ClassLoaderRepository;
*/
public
interface
MBeanServer
extends
MBeanServerConnection
{
// doc comment inherited from MBeanServerConnection
/**
* {@inheritDoc}
* <p>If this method successfully creates an MBean, a notification
* is sent as described <a href="#notif">above</a>.</p>
*/
public
ObjectInstance
createMBean
(
String
className
,
ObjectName
name
)
throws
ReflectionException
,
InstanceAlreadyExistsException
,
MBeanRegistrationException
,
MBeanException
,
NotCompliantMBeanException
;
// doc comment inherited from MBeanServerConnection
/**
* {@inheritDoc}
* <p>If this method successfully creates an MBean, a notification
* is sent as described <a href="#notif">above</a>.</p>
*/
public
ObjectInstance
createMBean
(
String
className
,
ObjectName
name
,
ObjectName
loaderName
)
throws
ReflectionException
,
InstanceAlreadyExistsException
,
MBeanRegistrationException
,
MBeanException
,
NotCompliantMBeanException
,
InstanceNotFoundException
;
// doc comment inherited from MBeanServerConnection
/**
* {@inheritDoc}
* <p>If this method successfully creates an MBean, a notification
* is sent as described <a href="#notif">above</a>.</p>
*/
public
ObjectInstance
createMBean
(
String
className
,
ObjectName
name
,
Object
params
[],
String
signature
[])
throws
ReflectionException
,
InstanceAlreadyExistsException
,
MBeanRegistrationException
,
MBeanException
,
NotCompliantMBeanException
;
// doc comment inherited from MBeanServerConnection
/**
* {@inheritDoc}
* <p>If this method successfully creates an MBean, a notification
* is sent as described <a href="#notif">above</a>.</p>
*/
public
ObjectInstance
createMBean
(
String
className
,
ObjectName
name
,
ObjectName
loaderName
,
Object
params
[],
String
signature
[])
...
...
@@ -287,12 +303,15 @@ public interface MBeanServer extends MBeanServerConnection {
NotCompliantMBeanException
,
InstanceNotFoundException
;
/**
* Registers a pre-existing object as an MBean with the MBean
*
<p>
Registers a pre-existing object as an MBean with the MBean
* server. If the object name given is null, the MBean must
* provide its own name by implementing the {@link
* javax.management.MBeanRegistration MBeanRegistration} interface
* and returning the name from the {@link
* MBeanRegistration#preRegister preRegister} method.
* MBeanRegistration#preRegister preRegister} method.</p>
*
* <p>If this method successfully registers an MBean, a notification
* is sent as described <a href="#notif">above</a>.</p>
*
* @param object The MBean to be registered as an MBean.
* @param name The object name of the MBean. May be null.
...
...
@@ -319,7 +338,12 @@ public interface MBeanServer extends MBeanServerConnection {
throws
InstanceAlreadyExistsException
,
MBeanRegistrationException
,
NotCompliantMBeanException
;
// doc comment inherited from MBeanServerConnection
/**
* {@inheritDoc}
*
* <p>If this method successfully unregisters an MBean, a notification
* is sent as described <a href="#notif">above</a>.</p>
*/
public
void
unregisterMBean
(
ObjectName
name
)
throws
InstanceNotFoundException
,
MBeanRegistrationException
;
...
...
src/share/classes/javax/management/modelmbean/RequiredModelMBean.java
浏览文件 @
1dab318d
...
...
@@ -48,6 +48,7 @@ import java.util.logging.Level;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Vector
;
import
javax.management.Attribute
;
import
javax.management.AttributeChangeNotification
;
import
javax.management.AttributeChangeNotificationFilter
;
...
...
@@ -132,8 +133,6 @@ public class RequiredModelMBean
* and operations will be executed */
private
Object
managedResource
=
null
;
private
static
final
String
currClass
=
"RequiredModelMBean"
;
/* records the registering in MBeanServer */
private
boolean
registered
=
false
;
private
transient
MBeanServer
server
=
null
;
...
...
@@ -2488,10 +2487,13 @@ public class RequiredModelMBean
}
if
(
MODELMBEAN_LOGGER
.
isLoggable
(
Level
.
FINER
))
{
Vector
<
String
>
enabledAttrs
=
currFilter
.
getEnabledAttributes
();
String
s
=
(
enabledAttrs
.
size
()
>
1
)
?
"["
+
enabledAttrs
.
firstElement
()
+
", ...]"
:
enabledAttrs
.
toString
();
MODELMBEAN_LOGGER
.
logp
(
Level
.
FINER
,
RequiredModelMBean
.
class
.
getName
(),
mth
,
"Set attribute change filter to "
+
currFilter
.
getEnabledAttributes
().
firstElement
());
"Set attribute change filter to "
+
s
);
}
attributeBroadcaster
.
addNotificationListener
(
inlistener
,
currFilter
,
...
...
src/share/classes/sun/management/Flag.java
浏览文件 @
1dab318d
...
...
@@ -64,7 +64,8 @@ class Flag {
}
VMOption
getVMOption
()
{
return
new
VMOption
(
name
,
value
.
toString
(),
writeable
,
origin
);
String
val
=
value
==
null
?
""
:
value
.
toString
();
return
new
VMOption
(
name
,
val
,
writeable
,
origin
);
}
static
Flag
getFlag
(
String
name
)
{
...
...
test/com/sun/management/HotSpotDiagnosticMXBean/GetDiagnosticOptions.java
0 → 100644
浏览文件 @
1dab318d
/*
* Copyright 2005 Sun Microsystems, Inc. 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.
*
* 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6658779
* @summary Basic Test for HotSpotDiagnosticMXBean.getDiagnosticOptions()
* @author Daniel Fuchs
*
* @run main GetDiagnosticOptions
*/
import
com.sun.management.HotSpotDiagnosticMXBean
;
import
com.sun.management.VMOption
;
import
java.lang.management.ManagementFactory
;
import
java.util.List
;
import
javax.management.MBeanServer
;
public
class
GetDiagnosticOptions
{
private
static
String
HOTSPOT_DIAGNOSTIC_MXBEAN_NAME
=
"com.sun.management:type=HotSpotDiagnostic"
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
HotSpotDiagnosticMXBean
mbean
=
sun
.
management
.
ManagementFactory
.
getDiagnosticMXBean
();
checkDiagnosticOptions
(
mbean
);
MBeanServer
mbs
=
ManagementFactory
.
getPlatformMBeanServer
();
mbean
=
ManagementFactory
.
newPlatformMXBeanProxy
(
mbs
,
HOTSPOT_DIAGNOSTIC_MXBEAN_NAME
,
HotSpotDiagnosticMXBean
.
class
);
checkDiagnosticOptions
(
mbean
);
}
private
static
void
checkDiagnosticOptions
(
HotSpotDiagnosticMXBean
mbean
)
{
List
<
VMOption
>
options
=
mbean
.
getDiagnosticOptions
();
for
(
VMOption
opt
:
options
)
{
System
.
out
.
println
(
"option: "
+
opt
.
getName
()+
"="
+
opt
.
getValue
());
}
}
}
test/javax/management/modelmbean/LoggingExceptionTest.java
0 → 100644
浏览文件 @
1dab318d
/*
* @test
* @bug 6471865 6675768
* @summary DescriptorSupport constructors throw IAE when traces are enabled;
* RequiredModelMBean.addAttributeChangeNotificationListener throws exception
* when traces enabled and no attributes.
* @author Luis-Miguel Alventosa
* @author Paul Cheeseman
*/
import
java.util.logging.ConsoleHandler
;
import
java.util.logging.Handler
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.management.Notification
;
import
javax.management.NotificationListener
;
import
javax.management.modelmbean.DescriptorSupport
;
import
javax.management.modelmbean.RequiredModelMBean
;
public
class
LoggingExceptionTest
{
private
static
final
String
tests
[]
=
new
String
[]
{
"DescriptorSupport()"
,
"DescriptorSupport(int)"
,
"DescriptorSupport(String)"
,
"DescriptorSupport(String...)"
,
"DescriptorSupport(String[], Object[])"
,
"DescriptorSupport(DescriptorSupport)"
,
"RequiredModelMBean.addAttributeChangeNotificationListener"
,
};
public
static
void
main
(
String
[]
args
)
{
Handler
handler
=
new
ConsoleHandler
();
Logger
logger
=
Logger
.
getLogger
(
"javax.management.modelmbean"
);
logger
.
addHandler
(
handler
);
logger
.
setLevel
(
Level
.
FINEST
);
try
{
for
(
int
i
=
0
;
i
<
tests
.
length
;
i
++)
{
System
.
out
.
println
(
">>> DescriptorSupportLoggingTest: Test Case "
+
i
);
DescriptorSupport
ds
;
String
msg
=
"Instantiate "
+
tests
[
i
];
System
.
out
.
println
(
msg
);
switch
(
i
)
{
case
0
:
ds
=
new
DescriptorSupport
();
break
;
case
1
:
ds
=
new
DescriptorSupport
(
10
);
break
;
case
2
:
ds
=
new
DescriptorSupport
(
new
DescriptorSupport
().
toXMLString
());
break
;
case
3
:
ds
=
new
DescriptorSupport
(
"name1=value1"
,
"name2=value2"
);
break
;
case
4
:
ds
=
new
DescriptorSupport
(
new
String
[]
{
"name"
},
new
Object
[]
{
"value"
});
break
;
case
5
:
ds
=
new
DescriptorSupport
(
new
DescriptorSupport
());
break
;
case
6
:
RequiredModelMBean
mbean
=
new
RequiredModelMBean
();
NotificationListener
nl
=
new
NotificationListener
()
{
public
void
handleNotification
(
Notification
notification
,
Object
handback
)
{}
};
mbean
.
addAttributeChangeNotificationListener
(
nl
,
null
,
null
);
break
;
default
:
throw
new
AssertionError
();
}
System
.
out
.
println
(
msg
+
" OK"
);
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Got unexpected exception = "
+
e
);
String
msg
=
"Test FAILED!"
;
System
.
out
.
println
(
msg
);
throw
new
IllegalArgumentException
(
msg
);
}
System
.
out
.
println
(
"Test PASSED!"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录