static ObjectName ensureMBeanIsRegistered(ManagedResource resource) {
    try {
      ObjectName objName = ObjectName.getInstance(resource.getMBeanName());
      synchronized (MBeanUtils.class) {
        if (mbeanServer != null && !mbeanServer.isRegistered(objName)) {
          return createMBean(resource);
        }
      }
      raiseOnFailure(mbeanServer.isRegistered(objName),
          String.format("Could not find a MBean registered with ObjectName: %s.",
              objName.toString()));
      return objName;
    } catch (java.lang.Exception e) {
      throw new RuntimeAdminException(e);
    }
  }
Ensures that an MBean is registered for the specified <code>ManagedResource</code>. If an MBean
cannot be found in the <code>MBeanServer</code>, then this creates and registers a
<code>ModelMBean</code>. State changing callbacks into the <code>ManagedResource</code> will
also be made.

@param resource the ManagedResource to create a managing MBean for

@return The object name of the MBean that manages the ManagedResource

@see ManagedResource#setModelMBean
geode-core/src/main/java/org/apache/geode/admin/jmx/internal/MBeanUtils.java