public static String getMBeanAttribute ( String name , String attrName ) throws JMException { MBeanServer server = getMBeanServer ( ) ; ObjectName objName = new ObjectName ( name ) ; String value = null ; try { Object attr = server . getAttribute ( objName , attrName ) ; if ( attr != null ) value = attr . toString ( ) ; } catch ( JMException e ) { value = e . getMessage ( ) ; } return value ; }
Get MBean attribute