@FFDCIgnore(Throwable.class)
    void introspectMBeanAttributes(MBeanServer mbeanServer, ObjectName mbean, PrintWriter writer) {
        try {
            // Dump the description and the canonical form of the object name
            writer.println();
            writer.print(mbeanServer.getMBeanInfo(mbean).getDescription());
            writer.println(" (" + mbean.getCanonicalName() + ")");

            // Iterate over the attributes of the mbean.  For each, capture the name
            // and then attempt format the attribute.
            String indent = INDENT;
            MBeanAttributeInfo[] attrs = mbeanServer.getMBeanInfo(mbean).getAttributes();
            for (MBeanAttributeInfo attr : attrs) {
                StringBuilder sb = new StringBuilder();
                sb.append(indent).append(attr.getName()).append(": ");
                sb.append(getFormattedAttribute(mbeanServer, mbean, attr, indent));
                writer.println(sb.toString());
            }
        } catch (Throwable t) {
            Throwable rootCause = t;
            while (rootCause.getCause() != null) {
                rootCause = rootCause.getCause();
            }
            StringBuilder sb = new StringBuilder();
            sb.append("<<Introspection failed: ");
            sb.append(rootCause.getMessage() != null ? rootCause.getMessage() : rootCause);
            sb.append(">>");
            writer.println(sb.toString());
        }
    }
@ FFDCIgnore ( Throwable . class ) void introspectMBeanAttributes ( MBeanServer mbeanServer , ObjectName mbean , PrintWriter writer ) { try { writer . println ( ) ; writer . print ( mbeanServer . getMBeanInfo ( mbean ) . getDescription ( ) ) ; writer . println ( " (" + mbean . getCanonicalName ( ) + ")" ) ; String indent = INDENT ; MBeanAttributeInfo [ ] attrs = mbeanServer . getMBeanInfo ( mbean ) . getAttributes ( ) ; for ( MBeanAttributeInfo attr : attrs ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( indent ) . append ( attr . getName ( ) ) . append ( ": " ) ; sb . append ( getFormattedAttribute ( mbeanServer , mbean , attr , indent ) ) ; writer . println ( sb . toString ( ) ) ; } } catch ( Throwable t ) { Throwable rootCause = t ; while ( rootCause . getCause ( ) != null ) { rootCause = rootCause . getCause ( ) ; } StringBuilder sb = new StringBuilder ( ) ; sb . append ( "<<Introspection failed: " ) ; sb . append ( rootCause . getMessage ( ) != null ? rootCause . getMessage ( ) : rootCause ) ; sb . append ( ">>" ) ; writer . println ( sb . toString ( ) ) ; } }
Introspect an MBean's attributes. Introspection will capture the MBean's
description, its canonical object name, and its attributes. When attributes
are a complex {@link OpenType}, an attempt will be made to format the complex
type. Primitives and types that do not have metadata will be formatted
with {@linkplain String#valueOf}.

@param mbeanServer the mbean server hosting the mbean
@param mbean the mbean to introspect
@param writer the print writer to write the instrospection to