private Runnable createAgentProcessRunnable(final Agent agent) {
    return new Runnable() {
      @Override
      public void run() {
        try {
          agent.start();
          writeStatus(createStatus(basename, RUNNING, OSProcess.getId()));
        } catch (IOException e) {
          e.printStackTrace();
        } catch (GemFireException e) {
          e.printStackTrace();
          handleGemFireException(e);
        }
      }

      private void handleGemFireException(final GemFireException e) {
        String message = String.format("Server failed to start: %s",
            e.getMessage());

        if (e.getCause() != null) {
          if (e.getCause().getCause() != null) {
            message += ", " + e.getCause().getCause().getMessage();
          }
        }

        setServerError(null, new Exception(message));
      }
    };
  }
Starts the GemFire JMX Agent "server" process with the given command line arguments.
geode-core/src/main/java/org/apache/geode/admin/jmx/internal/AgentLauncher.java