public static void waitForPrimaryIdentification() {
    assertNotNull(cache);
    if (!identifiedPrimary) {
      synchronized (HAStartupAndFailoverDUnitTest.class) {
        if (!identifiedPrimary) {
          final int MAX_WAIT = 60 * 1000;
          try {
            HAStartupAndFailoverDUnitTest.class.wait(MAX_WAIT);
          } catch (InterruptedException e) {
            fail("Test failed due to InterruptedException in waitForPrimaryIdentification()");
          }
          if (!identifiedPrimary) {
            fail("timed out after waiting " + MAX_WAIT + " millisecs"
                + " for primary to be identified");
          }
        }
      }
    }
  }
Tests failover initialization by cache operation Threads on secondary
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java