public boolean volunteerForPrimary() {
    if (logger.isDebugEnabled()) {
      logger.debug("Sender : {} is volunteering for Primary ", sender.getId());
    }

    if (advisePrimaryGatewaySender() == null) {
      if (!adviseEldestGatewaySender()) {
        if (logger.isDebugEnabled()) {
          logger.debug(
              "Sender {} is not the eldest in the system. Giving preference to eldest sender to become primary...",
              sender);
        }
        return false;
      }
      if (logger.isDebugEnabled()) {
        logger.debug("Sender : {} no Primary available. So going to acquire distributed lock",
            sender);
      }
      lockService.lock(lockToken, 10000, -1);
      return lockService.isHeldByCurrentThread(lockToken);
    }
    return false;
  }
When the sender profile is removed, then check for the primary members if they are not
available then this secondary sender should volunteer for primary
geode-core/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderAdvisor.java