@Override
  @edu.umd.cs.findbugs.annotations.SuppressWarnings(
      value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD",
      justification = "This is only a style warning.")
  public ObjectName connectToSystem() throws AdminException, MalformedObjectNameException {
    synchronized (CONN_SYNC) {
      try {
        if (isConnected()) {
          return ((AdminDistributedSystemJmxImpl) system).getObjectName();
        }

        ClusterDistributionManager.setIsDedicatedAdminVM(true);

        AdminDistributedSystemJmxImpl systemJmx = (AdminDistributedSystemJmxImpl) system;
        if (systemJmx == null) {
          systemJmx = (AdminDistributedSystemJmxImpl) createDistributedSystem(agentConfig);
          system = systemJmx;
        }
        systemJmx.connect(logWriter);

        return new ObjectName(systemJmx.getMBeanName());
      } catch (AdminException e) {
        logger.warn(e.getMessage(), e);
        throw e;
      } catch (RuntimeException e) {
        logger.warn(e.getMessage(), e);
        throw e;
      } catch (VirtualMachineError err) {
        SystemFailure.initiateFailure(err);
        // If this ever returns, rethrow the error. We're poisoned
        // now, so don't let this thread continue.
        throw err;
      } catch (Error e) {
        // Whenever you catch Error or Throwable, you must also
        // catch VirtualMachineError (see above). However, there is
        // _still_ a possibility that you are dealing with a cascading
        // error condition, so you also need to check to see if the JVM
        // is still usable:
        SystemFailure.checkFailure();
        logger.error(e.getMessage(), e);
        throw e;
      }
    }
  }
Connects to the DistributedSystem currently described by this Agent's attributes for
administration and monitoring.

@return the object name of the system that the Agent is now connected to
geode-core/src/main/java/org/apache/geode/admin/jmx/internal/AgentImpl.java