protected String getSingleStringAttribute ( MBeanServerExecutor pMBeanServerExecutor , String pMBeanName , String pAttribute ) { Set < ObjectName > serverMBeanNames = searchMBeans ( pMBeanServerExecutor , pMBeanName ) ; if ( serverMBeanNames . size ( ) == 0 ) { return null ; } Set < String > attributeValues = new HashSet < String > ( ) ; for ( ObjectName oName : serverMBeanNames ) { String val = getAttributeValue ( pMBeanServerExecutor , oName , pAttribute ) ; if ( val != null ) { attributeValues . add ( val ) ; } } if ( attributeValues . size ( ) == 0 || attributeValues . size ( ) > 1 ) { return null ; } return attributeValues . iterator ( ) . next ( ) ; }
Get a single attribute for a given MBeanName pattern .