code: public static void registerMbean(MBeanServer server, ModelMBean mbean, ObjectName name) {
          try {
              synchronized(LOCK) {
                  if(server.isRegistered(name))
                      JmxUtils.unregisterMbean(server, name);
                  server.registerMBean(mbean, name);
              }
          } catch(Exception e) {
              logger.error("Error registering mbean:", e);
          }
      }
docs: Register the given mbean with the server
  
  @param server The server to register with
  @param mbean The mbean to register
  @param name The name to register under