@Override
  public void profileUpdated(Profile profile) {
    if (profile instanceof GatewaySenderProfile) {
      GatewaySenderProfile sp = (GatewaySenderProfile) profile;
      if (!sp.isParallel) { // SerialGatewaySender
        if (!sp.isRunning) {
          if (advisePrimaryGatewaySender() != null) {
            return;
          }
          // IF this sender is not primary
          if (!sender.isPrimary()) {
            if (!adviseEldestGatewaySender()) {// AND this is not the eldest
                                               // sender
              if (logger.isDebugEnabled()) {
                logger.debug(
                    "Sender {} is not the eldest in the system. Giving preference to eldest sender to become primary...",
                    sender);
              }
              return;
            }
            launchLockObtainingVolunteerThread();
          }
        } else {
          if (sp.serverLocation != null) {
            sender.setServerLocation(sp.serverLocation);
          }
        }
      }
    }
  }
If there is change in sender which having policy as primary. 1. If that sender is stopped then
if there are no other primary senders then this sender should volunteer for primary. 2. If this
sender is primary and its policy is secondary then this sender should release the lock so that
other primary sender which s waiting on lock will get the lock.
geode-core/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderAdvisor.java