public List < String > getKeysFromRegex ( String regex ) { List < String > keys = Lists . newArrayList ( ) ; try { // List all objects in the domain ObjectName name = new ObjectName ( regex ) ; Set < ObjectName > objs = mBeanServer . queryNames ( name , null ) ; // Convert object naems to a tree for ( ObjectName objName : objs ) { MBeanInfo info = mBeanServer . getMBeanInfo ( objName ) ; keys . add ( objName . getCanonicalName ( ) ) ; } } catch ( Exception e ) { LOG . error ( "Exception in getKeysFromRegex " , e ) ; } return keys ; }
Return the list of all keys matching a regex