private void unregisterBeans(String domain) {
    MBeanServer mbs = mBeanServer;
    if (mbs != null) {
      Set<ObjectName> queryNames;
      try {
        queryNames =
            mbs.queryNames(new ObjectName(domain + ":*,node=" + tunnelingHandler.getUUID()), null);
      } catch (MalformedObjectNameException e1) {
        throw new RuntimeException(e1);
      }

      for (ObjectName name : queryNames) {
        try {
          mbs.unregisterMBean(name);
        } catch (Exception e) {
          logger.error("error unregistering " + name, e);
        }
      }
    }
  }
 protected void registerMBean(Object bean, ObjectName name)
     throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException,
         MalformedObjectNameException {
   ObjectName modifiedName = TerracottaManagement.addNodeInfo(name, tunnelingHandler.getUUID());
   mBeanServer.registerMBean(bean, modifiedName);
 }