code: public void waitForValidValues() throws IOException, InterruptedException {
          final int MS_BETWEEN_ATTEMPTS = 500;
          long startTime = System.currentTimeMillis();
          long timeout = startTime + getServerStartupTimeoutSeconds() * 1000;
          while (true) {
              Log.debug("Looking for valid port file values...");
              if (exists()) {
                  lock();
                  getValues();
                  unlock();
              }
              if (containsPortInfo) {
                  Log.debug("Valid port file values found after " + (System.currentTimeMillis() - startTime) + " ms");
                  return;
              }
              if (System.currentTimeMillis() > timeout) {
                  break;
              }
              Thread.sleep(MS_BETWEEN_ATTEMPTS);
          }
          throw new IOException("No port file values materialized. Giving up after " +
                                        (System.currentTimeMillis() - startTime) + " ms");
      }
docs: Wait for the port file to contain values that look valid.