Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
9a1ff143
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看板
提交
9a1ff143
编写于
3月 28, 2013
作者:
J
jbachorik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8008982: Adjust JMX for underlying interface changes
Reviewed-by: mchung, dholmes, dfuchs, skoivu
上级
56293e94
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
71 addition
and
39 deletion
+71
-39
src/share/classes/com/sun/jmx/mbeanserver/Introspector.java
src/share/classes/com/sun/jmx/mbeanserver/Introspector.java
+5
-0
src/share/classes/javax/management/JMX.java
src/share/classes/javax/management/JMX.java
+65
-25
src/share/classes/javax/management/MBeanServerInvocationHandler.java
...lasses/javax/management/MBeanServerInvocationHandler.java
+1
-14
未找到文件。
src/share/classes/com/sun/jmx/mbeanserver/Introspector.java
浏览文件 @
9a1ff143
...
...
@@ -228,6 +228,11 @@ public class Introspector {
MXBeanIntrospector
.
getInstance
().
getAnalyzer
(
interfaceClass
);
}
public
static
void
testComplianceMBeanInterface
(
Class
<?>
interfaceClass
)
throws
NotCompliantMBeanException
{
StandardMBeanIntrospector
.
getInstance
().
getAnalyzer
(
interfaceClass
);
}
/**
* Basic method for testing if a given class is a JMX compliant
* Standard MBean. This method is only called by the legacy code
...
...
src/share/classes/javax/management/JMX.java
浏览文件 @
9a1ff143
...
...
@@ -27,7 +27,9 @@ package javax.management;
import
com.sun.jmx.mbeanserver.Introspector
;
import
java.lang.reflect.InvocationHandler
;
import
java.lang.reflect.Modifier
;
import
java.lang.reflect.Proxy
;
import
sun.reflect.misc.ReflectUtil
;
/**
* Static methods from the JMX API. There are no instances of this class.
...
...
@@ -203,11 +205,7 @@ public class JMX {
ObjectName
objectName
,
Class
<
T
>
interfaceClass
,
boolean
notificationEmitter
)
{
return
MBeanServerInvocationHandler
.
newProxyInstance
(
connection
,
objectName
,
interfaceClass
,
notificationEmitter
);
return
createProxy
(
connection
,
objectName
,
interfaceClass
,
notificationEmitter
,
false
);
}
/**
...
...
@@ -345,26 +343,7 @@ public class JMX {
ObjectName
objectName
,
Class
<
T
>
interfaceClass
,
boolean
notificationEmitter
)
{
// Check interface for MXBean compliance
//
try
{
Introspector
.
testComplianceMXBeanInterface
(
interfaceClass
);
}
catch
(
NotCompliantMBeanException
e
)
{
throw
new
IllegalArgumentException
(
e
);
}
InvocationHandler
handler
=
new
MBeanServerInvocationHandler
(
connection
,
objectName
,
true
);
final
Class
<?>[]
interfaces
;
if
(
notificationEmitter
)
{
interfaces
=
new
Class
<?>[]
{
interfaceClass
,
NotificationEmitter
.
class
};
}
else
interfaces
=
new
Class
<?>[]
{
interfaceClass
};
Object
proxy
=
Proxy
.
newProxyInstance
(
interfaceClass
.
getClassLoader
(),
interfaces
,
handler
);
return
interfaceClass
.
cast
(
proxy
);
return
createProxy
(
connection
,
objectName
,
interfaceClass
,
notificationEmitter
,
true
);
}
/**
...
...
@@ -392,4 +371,65 @@ public class JMX {
// exactly the string "MXBean" since that would mean there
// was no package name, which is pretty unlikely in practice.
}
/**
* Centralised M(X)Bean proxy creation code
* @param connection {@linkplain MBeanServerConnection} to use
* @param objectName M(X)Bean object name
* @param interfaceClass M(X)Bean interface class
* @param notificationEmitter Is a notification emitter?
* @param isMXBean Is an MXBean?
* @return Returns an M(X)Bean proxy generated for the provided interface class
* @throws SecurityException
* @throws IllegalArgumentException
*/
private
static
<
T
>
T
createProxy
(
MBeanServerConnection
connection
,
ObjectName
objectName
,
Class
<
T
>
interfaceClass
,
boolean
notificationEmitter
,
boolean
isMXBean
)
{
if
(
System
.
getSecurityManager
()
!=
null
)
{
checkProxyInterface
(
interfaceClass
);
}
try
{
if
(
isMXBean
)
{
// Check interface for MXBean compliance
Introspector
.
testComplianceMXBeanInterface
(
interfaceClass
);
}
else
{
// Check interface for MBean compliance
Introspector
.
testComplianceMBeanInterface
(
interfaceClass
);
}
}
catch
(
NotCompliantMBeanException
e
)
{
throw
new
IllegalArgumentException
(
e
);
}
InvocationHandler
handler
=
new
MBeanServerInvocationHandler
(
connection
,
objectName
,
isMXBean
);
final
Class
<?>[]
interfaces
;
if
(
notificationEmitter
)
{
interfaces
=
new
Class
<?>[]
{
interfaceClass
,
NotificationEmitter
.
class
};
}
else
interfaces
=
new
Class
<?>[]
{
interfaceClass
};
Object
proxy
=
Proxy
.
newProxyInstance
(
interfaceClass
.
getClassLoader
(),
interfaces
,
handler
);
return
interfaceClass
.
cast
(
proxy
);
}
/**
* Checks for the M(X)Bean proxy interface being public and not restricted
* @param interfaceClass MBean proxy interface
* @throws SecurityException when the proxy interface comes from a restricted
* package or is not public
*/
private
static
void
checkProxyInterface
(
Class
<?>
interfaceClass
)
{
if
(!
Modifier
.
isPublic
(
interfaceClass
.
getModifiers
()))
{
throw
new
SecurityException
(
"mbean proxy interface non-public"
);
}
ReflectUtil
.
checkPackageAccess
(
interfaceClass
);
}
}
src/share/classes/javax/management/MBeanServerInvocationHandler.java
浏览文件 @
9a1ff143
...
...
@@ -231,20 +231,7 @@ public class MBeanServerInvocationHandler implements InvocationHandler {
ObjectName
objectName
,
Class
<
T
>
interfaceClass
,
boolean
notificationBroadcaster
)
{
final
InvocationHandler
handler
=
new
MBeanServerInvocationHandler
(
connection
,
objectName
);
final
Class
<?>[]
interfaces
;
if
(
notificationBroadcaster
)
{
interfaces
=
new
Class
<?>[]
{
interfaceClass
,
NotificationEmitter
.
class
};
}
else
interfaces
=
new
Class
<?>[]
{
interfaceClass
};
Object
proxy
=
Proxy
.
newProxyInstance
(
interfaceClass
.
getClassLoader
(),
interfaces
,
handler
);
return
interfaceClass
.
cast
(
proxy
);
return
JMX
.
newMBeanProxy
(
connection
,
objectName
,
interfaceClass
,
notificationBroadcaster
);
}
public
Object
invoke
(
Object
proxy
,
Method
method
,
Object
[]
args
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录