private GMSMembershipView<ID> copyCurrentViewAndAddMyAddress(ID oldCoordinator) {
    boolean testing = unitTesting.contains("noRandomViewChange");
    GMSMembershipView<ID> newView;
    Set<ID> leaving = new HashSet<>();
    Set<ID> removals;
    synchronized (viewInstallationLock) {
      int rand = testing ? 0 : GMSMembershipView.RANDOM.nextInt(10);
      int viewNumber = currentView.getViewId() + 5 + rand;
      if (localAddress.getVmViewId() < 0) {
        localAddress.setVmViewId(viewNumber);
      }
      List<ID> mbrs = new ArrayList<>(currentView.getMembers());
      if (!mbrs.contains(localAddress)) {
        mbrs.add(localAddress);
      }
      synchronized (removedMembers) {
        removals = new HashSet<>(removedMembers);
      }
      synchronized (leftMembers) {
        leaving.addAll(leftMembers);
      }
      if (oldCoordinator != null && !removals.contains(oldCoordinator)) {
        leaving.add(oldCoordinator);
      }
      mbrs.removeAll(removals);
      mbrs.removeAll(leaving);
      newView = new GMSMembershipView<>(localAddress, viewNumber, mbrs, leaving, removals);
      newView.setFailureDetectionPorts(currentView);
      newView.setPublicKeys(currentView);
      newView.setFailureDetectionPort(localAddress,
          services.getHealthMonitor().getFailureDetectionPort());
    }
    return newView;
  }
Transitions this member into the coordinator role. This must be invoked under a synch on
viewInstallationLock that was held at the time the decision was made to become coordinator so
that the decision is atomic with actually becoming coordinator.

@param oldCoordinator may be null
geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java