コード例 #1
0
ファイル: JMXUtil.java プロジェクト: Juliens/red5
 public static void printMBeanInfo(ObjectName objectName, String className) {
   log.info("Retrieve the management information for the {}", className);
   log.info("MBean using the getMBeanInfo() method of the MBeanServer");
   MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
   MBeanInfo info = null;
   try {
     info = mbs.getMBeanInfo(objectName);
   } catch (Exception e) {
     log.error("Could not get MBeanInfo object for {}", className, e);
     return;
   }
   log.info("CLASSNAME: \t" + info.getClassName());
   log.info("DESCRIPTION: \t" + info.getDescription());
   log.info("ATTRIBUTES");
   MBeanAttributeInfo[] attrInfo = info.getAttributes();
   if (attrInfo.length > 0) {
     for (int i = 0; i < attrInfo.length; i++) {
       log.info(" ** NAME: \t" + attrInfo[i].getName());
       log.info("    DESCR: \t" + attrInfo[i].getDescription());
       log.info(
           "    TYPE: \t"
               + attrInfo[i].getType()
               + "\tREAD: "
               + attrInfo[i].isReadable()
               + "\tWRITE: "
               + attrInfo[i].isWritable());
     }
   } else log.info(" ** No attributes **");
   log.info("CONSTRUCTORS");
   MBeanConstructorInfo[] constrInfo = info.getConstructors();
   for (int i = 0; i < constrInfo.length; i++) {
     log.info(" ** NAME: \t" + constrInfo[i].getName());
     log.info("    DESCR: \t" + constrInfo[i].getDescription());
     log.info("    PARAM: \t" + constrInfo[i].getSignature().length + " parameter(s)");
   }
   log.info("OPERATIONS");
   MBeanOperationInfo[] opInfo = info.getOperations();
   if (opInfo.length > 0) {
     for (int i = 0; i < opInfo.length; i++) {
       log.info(" ** NAME: \t" + opInfo[i].getName());
       log.info("    DESCR: \t" + opInfo[i].getDescription());
       log.info("    PARAM: \t" + opInfo[i].getSignature().length + " parameter(s)");
     }
   } else log.info(" ** No operations ** ");
   log.info("NOTIFICATIONS");
   MBeanNotificationInfo[] notifInfo = info.getNotifications();
   if (notifInfo.length > 0) {
     for (int i = 0; i < notifInfo.length; i++) {
       log.info(" ** NAME: \t" + notifInfo[i].getName());
       log.info("    DESCR: \t" + notifInfo[i].getDescription());
       String notifTypes[] = notifInfo[i].getNotifTypes();
       for (int j = 0; j < notifTypes.length; j++) {
         log.info("    TYPE: \t" + notifTypes[j]);
       }
     }
   } else {
     log.info(" ** No notifications **");
   }
 }
コード例 #2
0
 public ExoticMBeanInfo(MBeanInfo mbi) {
   super(
       mbi.getClassName(),
       mbi.getDescription(),
       mbi.getAttributes(),
       mbi.getConstructors(),
       mbi.getOperations(),
       mbi.getNotifications());
 }
コード例 #3
0
 @Override
 public MBeanInfo getMBeanInfo() {
   MBeanInfo info = super.getMBeanInfo();
   return new MBeanInfo(
       info.getClassName(),
       info.getDescription(),
       info.getAttributes(),
       info.getConstructors(),
       MBeanInfoHelper.getMBeanOperationsInfo(TopicControl.class),
       info.getNotifications());
 }