/**
* Build an adapted MBean for the given bean instance, if possible.
* <p>The default implementation builds a JMX 1.2 StandardMBean
* for the target's MBean/MXBean interface in case of an AOP proxy,
* delegating the interface's management operations to the proxy.
* @param bean the original bean instance
* @return the adapted MBean, or {@code null} if not possible
*/
@SuppressWarnings("unchecked")
protected DynamicMBean adaptMBeanIfPossible(Object bean) throws JMException {
Class<?> targetClass = AopUtils.getTargetClass(bean);
if (targetClass != bean.getClass()) {
Class<?> ifc = JmxUtils.getMXBeanInterface(targetClass);
if (ifc != null) {
if (!ifc.isInstance(bean)) {
throw new NotCompliantMBeanException("Managed bean [" + bean +
"] has a target class with an MXBean interface but does not expose it in the proxy");
}
return new StandardMBean(bean, ((Class<Object>) ifc), true);
}
else {
ifc = JmxUtils.getMBeanInterface(targetClass);
if (ifc != null) {
if (!ifc.isInstance(bean)) {
throw new NotCompliantMBeanException("Managed bean [" + bean +
"] has a target class with an MBean interface but does not expose it in the proxy");
}
return new StandardMBean(bean, ((Class<Object>) ifc));
}
}
}
return null;
}
java类javax.management.StandardMBean的实例源码
MBeanExporter.java 文件源码
项目:lams
阅读 25
收藏 0
点赞 0
评论 0
ServerDelegate.java 文件源码
项目:jdk8u-jdk
阅读 32
收藏 0
点赞 0
评论 0
/**
* Instantiates and registers a StandardMBean in the MBean server.
*
* @param implementationClassName
* The implementation class name of the MBean.
* @param interfaceClassName
* The management interface class name of the MBean.
* @param isMXBean
* If true, the resultant MBean is an MXBean.
* @param name
* The object name of the StandardMBean.
*/
@SuppressWarnings("unchecked")
public void createStandardMBean(
String implementationClassName,
String interfaceClassName,
boolean isMXBean,
ObjectName name)
throws Exception {
Object implementation =
Class.forName(implementationClassName).newInstance();
Class<Object> interfaceClass = interfaceClassName == null ? null :
(Class<Object>)Class.forName(interfaceClassName);
// Create the StandardMBean
StandardMBean standardMBean = new StandardMBean(
implementation,
interfaceClass,
isMXBean);
// Register the StandardMBean
mbeanServer.registerMBean(standardMBean, name);
}
ServerDelegate.java 文件源码
项目:jdk8u-jdk
阅读 24
收藏 0
点赞 0
评论 0
/**
* Instantiates and registers a StandardMBean in the MBean server.
*
* @param implementationClassName
* The implementation class name of the MBean.
* @param interfaceClassName
* The management interface class name of the MBean.
* @param isMXBean
* If true, the resultant MBean is an MXBean.
* @param name
* The object name of the StandardMBean.
*/
@SuppressWarnings("unchecked")
public void createStandardMBean(
String implementationClassName,
String interfaceClassName,
boolean isMXBean,
ObjectName name)
throws Exception {
Object implementation =
Class.forName(implementationClassName).newInstance();
Class<Object> interfaceClass = interfaceClassName == null ? null :
(Class<Object>)Class.forName(interfaceClassName);
// Create the StandardMBean
StandardMBean standardMBean = new StandardMBean(
implementation,
interfaceClass,
isMXBean);
// Register the StandardMBean
mbeanServer.registerMBean(standardMBean, name);
}
TooManyFooTest.java 文件源码
项目:jdk8u-jdk
阅读 31
收藏 0
点赞 0
评论 0
public static void main(String[] args) throws Exception {
final Child child = new Child();
test(child,"Child[MBean]",false);
final ChildMix childx = new ChildMix();
test(childx,"ChildMix[MXBean]",true);
final ChildMixMix childmx = new ChildMixMix();
test(childmx,"ChildMixMix[MXBean]",false);
final StandardMBean schild = new StandardMBean(child,ChildMBean.class);
test(schild,"Child[StandarMBean(Child)]",false);
final StandardMBean schildx =
new StandardMBean(childx,ChildMXBean.class,true);
test(schildx,"ChildMix[StandarMXBean(ChildMix)]",true);
final StandardMBean schildmx =
new StandardMBean(childmx,ChildMixMXBean.class,true);
test(schildmx,"ChildMixMix[StandarMXBean(ChildMixMix)]",true);
}
ServerDelegate.java 文件源码
项目:openjdk-jdk10
阅读 23
收藏 0
点赞 0
评论 0
/**
* Instantiates and registers a StandardMBean in the MBean server.
*
* @param implementationClassName
* The implementation class name of the MBean.
* @param interfaceClassName
* The management interface class name of the MBean.
* @param isMXBean
* If true, the resultant MBean is an MXBean.
* @param name
* The object name of the StandardMBean.
*/
@SuppressWarnings("unchecked")
public void createStandardMBean(
String implementationClassName,
String interfaceClassName,
boolean isMXBean,
ObjectName name)
throws Exception {
Object implementation =
Class.forName(implementationClassName).newInstance();
Class<Object> interfaceClass = interfaceClassName == null ? null :
(Class<Object>)Class.forName(interfaceClassName);
// Create the StandardMBean
StandardMBean standardMBean = new StandardMBean(
implementation,
interfaceClass,
isMXBean);
// Register the StandardMBean
mbeanServer.registerMBean(standardMBean, name);
}
ServerDelegate.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
/**
* Instantiates and registers a StandardMBean in the MBean server.
*
* @param implementationClassName
* The implementation class name of the MBean.
* @param interfaceClassName
* The management interface class name of the MBean.
* @param isMXBean
* If true, the resultant MBean is an MXBean.
* @param name
* The object name of the StandardMBean.
*/
@SuppressWarnings("unchecked")
public void createStandardMBean(
String implementationClassName,
String interfaceClassName,
boolean isMXBean,
ObjectName name)
throws Exception {
Object implementation =
Class.forName(implementationClassName).newInstance();
Class<Object> interfaceClass = interfaceClassName == null ? null :
(Class<Object>)Class.forName(interfaceClassName);
// Create the StandardMBean
StandardMBean standardMBean = new StandardMBean(
implementation,
interfaceClass,
isMXBean);
// Register the StandardMBean
mbeanServer.registerMBean(standardMBean, name);
}
TooManyFooTest.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
public static void main(String[] args) throws Exception {
final Child child = new Child();
test(child,"Child[MBean]",false);
final ChildMix childx = new ChildMix();
test(childx,"ChildMix[MXBean]",true);
final ChildMixMix childmx = new ChildMixMix();
test(childmx,"ChildMixMix[MXBean]",false);
final StandardMBean schild = new StandardMBean(child,ChildMBean.class);
test(schild,"Child[StandarMBean(Child)]",false);
final StandardMBean schildx =
new StandardMBean(childx,ChildMXBean.class,true);
test(schildx,"ChildMix[StandarMXBean(ChildMix)]",true);
final StandardMBean schildmx =
new StandardMBean(childmx,ChildMixMXBean.class,true);
test(schildmx,"ChildMixMix[StandarMXBean(ChildMixMix)]",true);
}
ServerDelegate.java 文件源码
项目:openjdk9
阅读 25
收藏 0
点赞 0
评论 0
/**
* Instantiates and registers a StandardMBean in the MBean server.
*
* @param implementationClassName
* The implementation class name of the MBean.
* @param interfaceClassName
* The management interface class name of the MBean.
* @param isMXBean
* If true, the resultant MBean is an MXBean.
* @param name
* The object name of the StandardMBean.
*/
@SuppressWarnings("unchecked")
public void createStandardMBean(
String implementationClassName,
String interfaceClassName,
boolean isMXBean,
ObjectName name)
throws Exception {
Object implementation =
Class.forName(implementationClassName).newInstance();
Class<Object> interfaceClass = interfaceClassName == null ? null :
(Class<Object>)Class.forName(interfaceClassName);
// Create the StandardMBean
StandardMBean standardMBean = new StandardMBean(
implementation,
interfaceClass,
isMXBean);
// Register the StandardMBean
mbeanServer.registerMBean(standardMBean, name);
}
ServerDelegate.java 文件源码
项目:openjdk9
阅读 23
收藏 0
点赞 0
评论 0
/**
* Instantiates and registers a StandardMBean in the MBean server.
*
* @param implementationClassName
* The implementation class name of the MBean.
* @param interfaceClassName
* The management interface class name of the MBean.
* @param isMXBean
* If true, the resultant MBean is an MXBean.
* @param name
* The object name of the StandardMBean.
*/
@SuppressWarnings("unchecked")
public void createStandardMBean(
String implementationClassName,
String interfaceClassName,
boolean isMXBean,
ObjectName name)
throws Exception {
Object implementation =
Class.forName(implementationClassName).newInstance();
Class<Object> interfaceClass = interfaceClassName == null ? null :
(Class<Object>)Class.forName(interfaceClassName);
// Create the StandardMBean
StandardMBean standardMBean = new StandardMBean(
implementation,
interfaceClass,
isMXBean);
// Register the StandardMBean
mbeanServer.registerMBean(standardMBean, name);
}
TooManyFooTest.java 文件源码
项目:openjdk9
阅读 29
收藏 0
点赞 0
评论 0
public static void main(String[] args) throws Exception {
final Child child = new Child();
test(child,"Child[MBean]",false);
final ChildMix childx = new ChildMix();
test(childx,"ChildMix[MXBean]",true);
final ChildMixMix childmx = new ChildMixMix();
test(childmx,"ChildMixMix[MXBean]",false);
final StandardMBean schild = new StandardMBean(child,ChildMBean.class);
test(schild,"Child[StandarMBean(Child)]",false);
final StandardMBean schildx =
new StandardMBean(childx,ChildMXBean.class,true);
test(schildx,"ChildMix[StandarMXBean(ChildMix)]",true);
final StandardMBean schildmx =
new StandardMBean(childmx,ChildMixMXBean.class,true);
test(schildmx,"ChildMixMix[StandarMXBean(ChildMixMix)]",true);
}
MBeanExporter.java 文件源码
项目:spring4-understanding
阅读 26
收藏 0
点赞 0
评论 0
/**
* Build an adapted MBean for the given bean instance, if possible.
* <p>The default implementation builds a JMX 1.2 StandardMBean
* for the target's MBean/MXBean interface in case of an AOP proxy,
* delegating the interface's management operations to the proxy.
* @param bean the original bean instance
* @return the adapted MBean, or {@code null} if not possible
*/
@SuppressWarnings("unchecked")
protected DynamicMBean adaptMBeanIfPossible(Object bean) throws JMException {
Class<?> targetClass = AopUtils.getTargetClass(bean);
if (targetClass != bean.getClass()) {
Class<?> ifc = JmxUtils.getMXBeanInterface(targetClass);
if (ifc != null) {
if (!ifc.isInstance(bean)) {
throw new NotCompliantMBeanException("Managed bean [" + bean +
"] has a target class with an MXBean interface but does not expose it in the proxy");
}
return new StandardMBean(bean, ((Class<Object>) ifc), true);
}
else {
ifc = JmxUtils.getMBeanInterface(targetClass);
if (ifc != null) {
if (!ifc.isInstance(bean)) {
throw new NotCompliantMBeanException("Managed bean [" + bean +
"] has a target class with an MBean interface but does not expose it in the proxy");
}
return new StandardMBean(bean, ((Class<Object>) ifc));
}
}
}
return null;
}
MBeanExporter.java 文件源码
项目:my-spring-cache-redis
阅读 31
收藏 0
点赞 0
评论 0
/**
* Build an adapted MBean for the given bean instance, if possible.
* <p>The default implementation builds a JMX 1.2 StandardMBean
* for the target's MBean/MXBean interface in case of an AOP proxy,
* delegating the interface's management operations to the proxy.
* @param bean the original bean instance
* @return the adapted MBean, or {@code null} if not possible
*/
@SuppressWarnings("unchecked")
protected DynamicMBean adaptMBeanIfPossible(Object bean) throws JMException {
Class<?> targetClass = AopUtils.getTargetClass(bean);
if (targetClass != bean.getClass()) {
Class<Object> ifc = (Class<Object>) JmxUtils.getMXBeanInterface(targetClass);
if (ifc != null) {
if (!(ifc.isInstance(bean))) {
throw new NotCompliantMBeanException("Managed bean [" + bean +
"] has a target class with an MXBean interface but does not expose it in the proxy");
}
return new StandardMBean(bean, ifc, true);
}
else {
ifc = (Class<Object>) JmxUtils.getMBeanInterface(targetClass);
if (ifc != null) {
if (!(ifc.isInstance(bean))) {
throw new NotCompliantMBeanException("Managed bean [" + bean +
"] has a target class with an MBean interface but does not expose it in the proxy");
}
return new StandardMBean(bean, ifc);
}
}
}
return null;
}
JMXManagementService.java 文件源码
项目:gemfirexd-oss
阅读 25
收藏 0
点赞 0
评论 0
/**
* Start the management service if gemfirexd.system.jmx is true.
* <P>
* Starting the service means:
* <UL>
* <LI> getting the platform MBeanServer which may require starting it
* <LI> registering a Version mbean representing the system
* </UL>
*/
public synchronized void boot(boolean create, Properties properties)
throws StandardException {
registeredMbeans = new HashMap<ObjectName,StandardMBean>();
systemIdentifier =
Monitor.getMonitor().getUUIDFactory().createUUID().toString();
findServer();
myManagementBean = (ObjectName) registerMBean(this,
ManagementMBean.class,
"type=Management");
myManagementServer = mbeanServer;
registerMBean(
new Version(
Monitor.getMonitor().getEngineVersion(),
SystemPermission.ENGINE),
VersionMBean.class,
"type=Version,jar=gemfirexd.jar");
}
ServerDelegate.java 文件源码
项目:jdk8u_jdk
阅读 23
收藏 0
点赞 0
评论 0
/**
* Instantiates and registers a StandardMBean in the MBean server.
*
* @param implementationClassName
* The implementation class name of the MBean.
* @param interfaceClassName
* The management interface class name of the MBean.
* @param isMXBean
* If true, the resultant MBean is an MXBean.
* @param name
* The object name of the StandardMBean.
*/
@SuppressWarnings("unchecked")
public void createStandardMBean(
String implementationClassName,
String interfaceClassName,
boolean isMXBean,
ObjectName name)
throws Exception {
Object implementation =
Class.forName(implementationClassName).newInstance();
Class<Object> interfaceClass = interfaceClassName == null ? null :
(Class<Object>)Class.forName(interfaceClassName);
// Create the StandardMBean
StandardMBean standardMBean = new StandardMBean(
implementation,
interfaceClass,
isMXBean);
// Register the StandardMBean
mbeanServer.registerMBean(standardMBean, name);
}
ServerDelegate.java 文件源码
项目:jdk8u_jdk
阅读 33
收藏 0
点赞 0
评论 0
/**
* Instantiates and registers a StandardMBean in the MBean server.
*
* @param implementationClassName
* The implementation class name of the MBean.
* @param interfaceClassName
* The management interface class name of the MBean.
* @param isMXBean
* If true, the resultant MBean is an MXBean.
* @param name
* The object name of the StandardMBean.
*/
@SuppressWarnings("unchecked")
public void createStandardMBean(
String implementationClassName,
String interfaceClassName,
boolean isMXBean,
ObjectName name)
throws Exception {
Object implementation =
Class.forName(implementationClassName).newInstance();
Class<Object> interfaceClass = interfaceClassName == null ? null :
(Class<Object>)Class.forName(interfaceClassName);
// Create the StandardMBean
StandardMBean standardMBean = new StandardMBean(
implementation,
interfaceClass,
isMXBean);
// Register the StandardMBean
mbeanServer.registerMBean(standardMBean, name);
}
TooManyFooTest.java 文件源码
项目:jdk8u_jdk
阅读 26
收藏 0
点赞 0
评论 0
public static void main(String[] args) throws Exception {
final Child child = new Child();
test(child,"Child[MBean]",false);
final ChildMix childx = new ChildMix();
test(childx,"ChildMix[MXBean]",true);
final ChildMixMix childmx = new ChildMixMix();
test(childmx,"ChildMixMix[MXBean]",false);
final StandardMBean schild = new StandardMBean(child,ChildMBean.class);
test(schild,"Child[StandarMBean(Child)]",false);
final StandardMBean schildx =
new StandardMBean(childx,ChildMXBean.class,true);
test(schildx,"ChildMix[StandarMXBean(ChildMix)]",true);
final StandardMBean schildmx =
new StandardMBean(childmx,ChildMixMXBean.class,true);
test(schildmx,"ChildMixMix[StandarMXBean(ChildMixMix)]",true);
}
ServerDelegate.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 29
收藏 0
点赞 0
评论 0
/**
* Instantiates and registers a StandardMBean in the MBean server.
*
* @param implementationClassName
* The implementation class name of the MBean.
* @param interfaceClassName
* The management interface class name of the MBean.
* @param isMXBean
* If true, the resultant MBean is an MXBean.
* @param name
* The object name of the StandardMBean.
*/
@SuppressWarnings("unchecked")
public void createStandardMBean(
String implementationClassName,
String interfaceClassName,
boolean isMXBean,
ObjectName name)
throws Exception {
Object implementation =
Class.forName(implementationClassName).newInstance();
Class<Object> interfaceClass = interfaceClassName == null ? null :
(Class<Object>)Class.forName(interfaceClassName);
// Create the StandardMBean
StandardMBean standardMBean = new StandardMBean(
implementation,
interfaceClass,
isMXBean);
// Register the StandardMBean
mbeanServer.registerMBean(standardMBean, name);
}
ServerDelegate.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 28
收藏 0
点赞 0
评论 0
/**
* Instantiates and registers a StandardMBean in the MBean server.
*
* @param implementationClassName
* The implementation class name of the MBean.
* @param interfaceClassName
* The management interface class name of the MBean.
* @param isMXBean
* If true, the resultant MBean is an MXBean.
* @param name
* The object name of the StandardMBean.
*/
@SuppressWarnings("unchecked")
public void createStandardMBean(
String implementationClassName,
String interfaceClassName,
boolean isMXBean,
ObjectName name)
throws Exception {
Object implementation =
Class.forName(implementationClassName).newInstance();
Class<Object> interfaceClass = interfaceClassName == null ? null :
(Class<Object>)Class.forName(interfaceClassName);
// Create the StandardMBean
StandardMBean standardMBean = new StandardMBean(
implementation,
interfaceClass,
isMXBean);
// Register the StandardMBean
mbeanServer.registerMBean(standardMBean, name);
}
TooManyFooTest.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 29
收藏 0
点赞 0
评论 0
public static void main(String[] args) throws Exception {
final Child child = new Child();
test(child,"Child[MBean]",false);
final ChildMix childx = new ChildMix();
test(childx,"ChildMix[MXBean]",true);
final ChildMixMix childmx = new ChildMixMix();
test(childmx,"ChildMixMix[MXBean]",false);
final StandardMBean schild = new StandardMBean(child,ChildMBean.class);
test(schild,"Child[StandarMBean(Child)]",false);
final StandardMBean schildx =
new StandardMBean(childx,ChildMXBean.class,true);
test(schildx,"ChildMix[StandarMXBean(ChildMix)]",true);
final StandardMBean schildmx =
new StandardMBean(childmx,ChildMixMXBean.class,true);
test(schildmx,"ChildMixMix[StandarMXBean(ChildMixMix)]",true);
}
MBeanExporter.java 文件源码
项目:spring
阅读 27
收藏 0
点赞 0
评论 0
/**
* Build an adapted MBean for the given bean instance, if possible.
* <p>The default implementation builds a JMX 1.2 StandardMBean
* for the target's MBean/MXBean interface in case of an AOP proxy,
* delegating the interface's management operations to the proxy.
* @param bean the original bean instance
* @return the adapted MBean, or {@code null} if not possible
*/
@SuppressWarnings("unchecked")
protected DynamicMBean adaptMBeanIfPossible(Object bean) throws JMException {
Class<?> targetClass = AopUtils.getTargetClass(bean);
if (targetClass != bean.getClass()) {
Class<?> ifc = JmxUtils.getMXBeanInterface(targetClass);
if (ifc != null) {
if (!ifc.isInstance(bean)) {
throw new NotCompliantMBeanException("Managed bean [" + bean +
"] has a target class with an MXBean interface but does not expose it in the proxy");
}
return new StandardMBean(bean, ((Class<Object>) ifc), true);
}
else {
ifc = JmxUtils.getMBeanInterface(targetClass);
if (ifc != null) {
if (!ifc.isInstance(bean)) {
throw new NotCompliantMBeanException("Managed bean [" + bean +
"] has a target class with an MBean interface but does not expose it in the proxy");
}
return new StandardMBean(bean, ((Class<Object>) ifc));
}
}
}
return null;
}
JMXManagementService.java 文件源码
项目:gemfirexd-oss
阅读 24
收藏 0
点赞 0
评论 0
/**
* Start the management service if gemfirexd.system.jmx is true.
* <P>
* Starting the service means:
* <UL>
* <LI> getting the platform MBeanServer which may require starting it
* <LI> registering a Version mbean representing the system
* </UL>
*/
public synchronized void boot(boolean create, Properties properties)
throws StandardException {
registeredMbeans = new HashMap<ObjectName,StandardMBean>();
systemIdentifier =
Monitor.getMonitor().getUUIDFactory().createUUID().toString();
findServer();
myManagementBean = (ObjectName) registerMBean(this,
ManagementMBean.class,
"type=Management");
myManagementServer = mbeanServer;
registerMBean(
new Version(
Monitor.getMonitor().getEngineVersion(),
SystemPermission.ENGINE),
VersionMBean.class,
"type=Version,jar=gemfirexd.jar");
}
TooManyFooTest.java 文件源码
项目:infobip-open-jdk-8
阅读 23
收藏 0
点赞 0
评论 0
public static void main(String[] args) throws Exception {
final Child child = new Child();
test(child,"Child[MBean]",false);
final ChildMix childx = new ChildMix();
test(childx,"ChildMix[MXBean]",true);
final ChildMixMix childmx = new ChildMixMix();
test(childmx,"ChildMixMix[MXBean]",false);
final StandardMBean schild = new StandardMBean(child,ChildMBean.class);
test(schild,"Child[StandarMBean(Child)]",false);
final StandardMBean schildx =
new StandardMBean(childx,ChildMXBean.class,true);
test(schildx,"ChildMix[StandarMXBean(ChildMix)]",true);
final StandardMBean schildmx =
new StandardMBean(childmx,ChildMixMXBean.class,true);
test(schildmx,"ChildMixMix[StandarMXBean(ChildMixMix)]",true);
}
TooManyFooTest.java 文件源码
项目:jdk8u-dev-jdk
阅读 35
收藏 0
点赞 0
评论 0
public static void main(String[] args) throws Exception {
final Child child = new Child();
test(child,"Child[MBean]",false);
final ChildMix childx = new ChildMix();
test(childx,"ChildMix[MXBean]",true);
final ChildMixMix childmx = new ChildMixMix();
test(childmx,"ChildMixMix[MXBean]",false);
final StandardMBean schild = new StandardMBean(child,ChildMBean.class);
test(schild,"Child[StandarMBean(Child)]",false);
final StandardMBean schildx =
new StandardMBean(childx,ChildMXBean.class,true);
test(schildx,"ChildMix[StandarMXBean(ChildMix)]",true);
final StandardMBean schildmx =
new StandardMBean(childmx,ChildMixMXBean.class,true);
test(schildmx,"ChildMixMix[StandarMXBean(ChildMixMix)]",true);
}
CertificateLocalizationService.java 文件源码
项目:hops
阅读 24
收藏 0
点赞 0
评论 0
@Override
protected void serviceStart() throws Exception {
String uuid = UUID.randomUUID().toString();
tmpDir = Paths.get(SYSTEM_TMP, LOCALIZATION_DIR).toFile();
if (!tmpDir.exists()) {
tmpDir.mkdir();
}
tmpDir.setExecutable(false, false);
tmpDir.setExecutable(true);
// Writable only to the owner
tmpDir.setWritable(false, false);
tmpDir.setWritable(true);
// Readable by none
tmpDir.setReadable(false, false);
materializeDir = Paths.get(tmpDir.getAbsolutePath(), uuid);
// Random materialization directory should have the default umask
materializeDir.toFile().mkdir();
LOG.debug("Initialized at dir: " + materializeDir.toString());
StandardMBean mbean = new StandardMBean(this, CertificateLocalizationMBean.class);
mbeanObjectName = MBeans.register(serviceName, "CertificateLocalizer", mbean);
super.serviceStart();
}
TooManyFooTest.java 文件源码
项目:jdk7-jdk
阅读 30
收藏 0
点赞 0
评论 0
public static void main(String[] args) throws Exception {
final Child child = new Child();
test(child,"Child[MBean]",false);
final ChildMix childx = new ChildMix();
test(childx,"ChildMix[MXBean]",true);
final ChildMixMix childmx = new ChildMixMix();
test(childmx,"ChildMixMix[MXBean]",false);
final StandardMBean schild = new StandardMBean(child,ChildMBean.class);
test(schild,"Child[StandarMBean(Child)]",false);
final StandardMBean schildx =
new StandardMBean(childx,ChildMXBean.class,true);
test(schildx,"ChildMix[StandarMXBean(ChildMix)]",true);
final StandardMBean schildmx =
new StandardMBean(childmx,ChildMixMXBean.class,true);
test(schildmx,"ChildMixMix[StandarMXBean(ChildMixMix)]",true);
}
TooManyFooTest.java 文件源码
项目:openjdk-source-code-learn
阅读 30
收藏 0
点赞 0
评论 0
public static void main(String[] args) throws Exception {
final Child child = new Child();
test(child,"Child[MBean]",false);
final ChildMix childx = new ChildMix();
test(childx,"ChildMix[MXBean]",true);
final ChildMixMix childmx = new ChildMixMix();
test(childmx,"ChildMixMix[MXBean]",false);
final StandardMBean schild = new StandardMBean(child,ChildMBean.class);
test(schild,"Child[StandarMBean(Child)]",false);
final StandardMBean schildx =
new StandardMBean(childx,ChildMXBean.class,true);
test(schildx,"ChildMix[StandarMXBean(ChildMix)]",true);
final StandardMBean schildmx =
new StandardMBean(childmx,ChildMixMXBean.class,true);
test(schildmx,"ChildMixMix[StandarMXBean(ChildMixMix)]",true);
}
MBeanExporter.java 文件源码
项目:class-guard
阅读 24
收藏 0
点赞 0
评论 0
/**
* Build an adapted MBean for the given bean instance, if possible.
* <p>The default implementation builds a JMX 1.2 StandardMBean
* for the target's MBean/MXBean interface in case of an AOP proxy,
* delegating the interface's management operations to the proxy.
* @param bean the original bean instance
* @return the adapted MBean, or {@code null} if not possible
*/
@SuppressWarnings("unchecked")
protected DynamicMBean adaptMBeanIfPossible(Object bean) throws JMException {
Class<?> targetClass = AopUtils.getTargetClass(bean);
if (targetClass != bean.getClass()) {
Class<?> ifc = JmxUtils.getMXBeanInterface(targetClass);
if (ifc != null) {
if (!ifc.isInstance(bean)) {
throw new NotCompliantMBeanException("Managed bean [" + bean +
"] has a target class with an MXBean interface but does not expose it in the proxy");
}
return new StandardMBean(bean, ((Class<Object>) ifc), true);
}
else {
ifc = JmxUtils.getMBeanInterface(targetClass);
if (ifc != null) {
if (!ifc.isInstance(bean)) {
throw new NotCompliantMBeanException("Managed bean [" + bean +
"] has a target class with an MBean interface but does not expose it in the proxy");
}
return new StandardMBean(bean, ((Class<Object>) ifc));
}
}
}
return null;
}
TooManyFooTest.java 文件源码
项目:OLD-OpenJDK8
阅读 28
收藏 0
点赞 0
评论 0
public static void main(String[] args) throws Exception {
final Child child = new Child();
test(child,"Child[MBean]",false);
final ChildMix childx = new ChildMix();
test(childx,"ChildMix[MXBean]",true);
final ChildMixMix childmx = new ChildMixMix();
test(childmx,"ChildMixMix[MXBean]",false);
final StandardMBean schild = new StandardMBean(child,ChildMBean.class);
test(schild,"Child[StandarMBean(Child)]",false);
final StandardMBean schildx =
new StandardMBean(childx,ChildMXBean.class,true);
test(schildx,"ChildMix[StandarMXBean(ChildMix)]",true);
final StandardMBean schildmx =
new StandardMBean(childmx,ChildMixMXBean.class,true);
test(schildmx,"ChildMixMix[StandarMXBean(ChildMixMix)]",true);
}
ModuleActivatorA.java 文件源码
项目:fabric8poc
阅读 22
收藏 0
点赞 0
评论 0
@Override
public void start(final ModuleContext context) throws Exception {
MBeanServer server = ServiceLocator.getRequiredService(context, MBeanServer.class);
ModuleStateA moduleState = new ModuleStateA() {
@Override
public String getResourceIdentity() {
return context.getModule().getIdentity().getCanonicalForm();
}
@Override
public String getModuleState() {
return context.getModule().getState().toString();
}
};
StandardMBean mbean = new StandardMBean(moduleState, ModuleStateA.class);
server.registerMBean(mbean, getObjectName(context.getModule()));
}
TooManyFooTest.java 文件源码
项目:JAVA_UNIT
阅读 26
收藏 0
点赞 0
评论 0
public static void main(String[] args) throws Exception {
final Child child = new Child();
test(child,"Child[MBean]",false);
final ChildMix childx = new ChildMix();
test(childx,"ChildMix[MXBean]",true);
final ChildMixMix childmx = new ChildMixMix();
test(childmx,"ChildMixMix[MXBean]",false);
final StandardMBean schild = new StandardMBean(child,ChildMBean.class);
test(schild,"Child[StandarMBean(Child)]",false);
final StandardMBean schildx =
new StandardMBean(childx,ChildMXBean.class,true);
test(schildx,"ChildMix[StandarMXBean(ChildMix)]",true);
final StandardMBean schildmx =
new StandardMBean(childmx,ChildMixMXBean.class,true);
test(schildmx,"ChildMixMix[StandarMXBean(ChildMixMix)]",true);
}