code: static MBeanServer registerJolokiaMBeanServerHolderMBean(MBeanServer pServer) {
          JolokiaMBeanServerHolder holder = new JolokiaMBeanServerHolder();
          ObjectName holderName = createObjectName(JolokiaMBeanServerHolderMBean.OBJECT_NAME);
          MBeanServer jolokiaMBeanServer;
          try {
              pServer.registerMBean(holder,holderName);
              jolokiaMBeanServer = holder.getJolokiaMBeanServer();
          } catch (InstanceAlreadyExistsException e) {
              // If the instance already exist, we look it up and fetch the MBeanServerHolder from there.
              // Might happen in race conditions.
              try {
                  jolokiaMBeanServer = (MBeanServer) pServer.getAttribute(holderName,JOLOKIA_MBEAN_SERVER_ATTRIBUTE);
              } catch (JMException e1) {
                  throw new IllegalStateException("Internal: Cannot get JolokiaMBean server in fallback JMX lookup " +
                                                  "while trying to register the holder MBean: " + e1,e1);
              }
          } catch (JMException e) {
              throw new IllegalStateException("Internal: JolokiaMBeanHolder cannot be registered to JMX: " + e,e);
          }
          return jolokiaMBeanServer;
      }
docs: package visible for unit testing