javax.management.MXBean.value()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(69)

本文整理了Java中javax.management.MXBean.value()方法的一些代码示例,展示了MXBean.value()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MXBean.value()方法的具体详情如下:
包路径:javax.management.MXBean
类名称:MXBean
方法名:value

MXBean.value介绍

暂无

代码示例

代码示例来源:origin: com.mycila/mycila-jmx

public static Boolean evaluateMXBeanAnnotation(Class<?> iface) {
    javax.management.MXBean mxBean = iface.getAnnotation(javax.management.MXBean.class);
    return (mxBean != null ? mxBean.value() : null);
  }
}

代码示例来源:origin: com.caucho/resin

/**
 * Returns the mbean interface.
 */
private Class<?> getMBeanInterface(Class<?> cl)
{
 for (; cl != null; cl = cl.getSuperclass()) {
  Class<?> []interfaces = cl.getInterfaces();
  for (int i = 0; i < interfaces.length; i++) {
   Class<?> ifc = interfaces[i];
   MXBean mxBean = ifc.getAnnotation(MXBean.class);
   
   if (mxBean != null) {
    if (mxBean.value()) {
     return ifc;
    }
    else {
     continue;
    }
   }
   
   if (ifc.getName().endsWith("MBean")
     || ifc.getName().endsWith("MXBean")) {
    return ifc;
   }
   
  }
 }
 return null;
}

代码示例来源:origin: net.e6tech/elements-jmx

@SuppressWarnings({"squid:S135", "squid:S2095"})
private static void register(Object mbean, ObjectName objectName) throws JMException {
  MBeanServer server = ManagementFactory.getPlatformMBeanServer();
  JmxServer jmxServer = new JmxServer(server);
  if (mbean.getClass().getAnnotation(JmxResource.class) != null) {
    jmxServer.register(mbean, objectName, null, null, null);
  } else {
    boolean conformToMBean = false;
    Class<?>[] interfaces = mbean.getClass().getInterfaces();
    for (Class<?> intf : interfaces) {
      MXBean annotation = intf.getAnnotation(MXBean.class);
      if (annotation != null) {
        conformToMBean = annotation.value();
        break;
      }
      if (intf.getSimpleName().endsWith("MXBean") || intf.getSimpleName().endsWith("MBean")) {
        conformToMBean = true;
        break;
      }
    }
    if (conformToMBean)
      server.registerMBean(mbean, objectName);
    else jmxServer.register(mbean, objectName, null, null, null);
  }
}

相关文章