private List<ObjectName> registerMBeans(MBeanServer pServer, String pDomain) {
        List<ObjectName> ret = new ArrayList<ObjectName>();
        try {
            // Register my test mbeans
            for (String name : strangeNamesShort) {
                String strangeName = pDomain + ":type=naming/,name=" + name;
                strangeNames.add(strangeName);
                ret.add(registerMBean(pServer, new ObjectNameChecking(strangeName), strangeName));
            }
            for (String name : escapedNamesShort) {
                String escapedName = pDomain + ":type=escape,name=" + ObjectName.quote(name);
                escapedNames.add(escapedName);
                ret.add(registerMBean(pServer, new ObjectNameChecking(escapedName), escapedName));
            }

            // Other MBeans with different names
            for (String name : fullNames) {
                ret.add(registerMBean(pServer, new ObjectNameChecking(name), name));
            }

            // Other MBeans
            boolean isWebsphere = checkForClass("com.ibm.websphere.management.AdminServiceFactory");
            ret.add(registerMBean(pServer,new OperationChecking(JOLOKIA_IT_DOMAIN),isWebsphere ? null : pDomain + ":type=operation"));
            ret.add(registerMBean(pServer, new AttributeChecking(JOLOKIA_IT_DOMAIN), isWebsphere ? null : pDomain + ":type=attribute"));
            // MXBean
            if (hasMxBeanSupport()) {
                ret.add(registerMBean(pServer, new MxBeanSample(), isWebsphere ? null : pDomain + ":type=mxbean"));
            }
            // Tabular Data MBean
            ret.add(registerMBean(pServer, new TabularMBean(), pDomain + ":type=tabularData"));
        } catch (RuntimeException e) {
            throw new RuntimeException("Error",e);
        } catch (Exception exp) {
            throw new RuntimeException("Error",exp);
        }
        return ret;
    }
private List < ObjectName > registerMBeans ( MBeanServer pServer , String pDomain ) { List < ObjectName > ret = new ArrayList < ObjectName > ( ) ; try { for ( String name : strangeNamesShort ) { String strangeName = pDomain + ":type=naming/,name=" + name ; strangeNames . add ( strangeName ) ; ret . add ( registerMBean ( pServer , new ObjectNameChecking ( strangeName ) , strangeName ) ) ; } for ( String name : escapedNamesShort ) { String escapedName = pDomain + ":type=escape,name=" + ObjectName . quote ( name ) ; escapedNames . add ( escapedName ) ; ret . add ( registerMBean ( pServer , new ObjectNameChecking ( escapedName ) , escapedName ) ) ; } for ( String name : fullNames ) { ret . add ( registerMBean ( pServer , new ObjectNameChecking ( name ) , name ) ) ; } boolean isWebsphere = checkForClass ( "com.ibm.websphere.management.AdminServiceFactory" ) ; ret . add ( registerMBean ( pServer , new OperationChecking ( JOLOKIA_IT_DOMAIN ) , isWebsphere ? null : pDomain + ":type=operation" ) ) ; ret . add ( registerMBean ( pServer , new AttributeChecking ( JOLOKIA_IT_DOMAIN ) , isWebsphere ? null : pDomain + ":type=attribute" ) ) ; if ( hasMxBeanSupport ( ) ) { ret . add ( registerMBean ( pServer , new MxBeanSample ( ) , isWebsphere ? null : pDomain + ":type=mxbean" ) ) ; } ret . add ( registerMBean ( pServer , new TabularMBean ( ) , pDomain + ":type=tabularData" ) ) ; } catch ( RuntimeException e ) { throw new RuntimeException ( "Error" , e ) ; } catch ( Exception exp ) { throw new RuntimeException ( "Error" , exp ) ; } return ret ; }
===================================================================================================