code: @Nullable
      public static ObjectName registerObject(Object object, String objectName, MBeanServer mbeanServer) {
          try {
              return mbeanServer.registerMBean(object, new ObjectName(objectName)).getObjectName();
          } catch (Exception e) {
              logger.warn("Failure to register {}:{}", objectName, object, e);
              return null;
          }
      }
docs: Try to register given <code>object</code> with <code>objectName</code>.
  
  If registration fails, a {@link Logger#warn(String)} message is emitted and <code>null</code> is returned.
  
  @param object
  @param objectName
  @param mbeanServer
  @return the ObjectName of the registered object or <code>null</code> if registration failed.