code: public final ObjectName registerMBean(Object pMBean,String ... pOptionalName)
              throws MalformedObjectNameException, NotCompliantMBeanException, InstanceAlreadyExistsException {
          synchronized (mBeanHandles) {
              MBeanServer server = ManagementFactory.getPlatformMBeanServer();
              try {
                  String name = pOptionalName != null && pOptionalName.length > 0 ? pOptionalName[0] : null;
                  ObjectName registeredName = serverHandle.registerMBeanAtServer(server, pMBean, name);
                  mBeanHandles.add(new MBeanHandle(server,registeredName));
                  return registeredName;
              } catch (RuntimeException exp) {
                  throw new IllegalStateException("Could not register " + pMBean + ": " + exp, exp);
              } catch (MBeanRegistrationException exp) {
                  throw new IllegalStateException("Could not register " + pMBean + ": " + exp, exp);
              }
          }
      }
docs: Register a MBean under a certain name to the platform MBeanServer
  
  @param pMBean MBean to register
  @param pOptionalName optional name under which the bean should be registered. If not provided,
  it depends on whether the MBean to register implements {@link javax.management.MBeanRegistration} or
  not.
  
  @return the name under which the MBean is registered.