code: public void watchStartup(int startingTimeout, int startupTimeout)
              throws Exception {
  
          // use this for timeout checks later
          long startTime = System.currentTimeMillis();
  
          ServerStatusMessage[] messages = getAllMessages();
  
          ServerStatusMessage lastMessage = messages[messages.length - 1];
  
          boolean starting = false;
          boolean started = false;
          while (!started) {
  
              showStartup(messages);
  
              // update started and starting flags, and
              // throw a startup exception if startup failed
              // is encountered
              for (ServerStatusMessage element : messages) {
                  ServerState state = element.getState();
                  if (state == ServerState.STARTING) {
                      starting = true;
                  } else if (state == ServerState.STARTED) {
                      started = true;
                  } else if (state == ServerState.STARTUP_FAILED) {
                      throw new Exception("Fedora startup failed (see above)");
                  }
              }
  
              if (!started) {
  
                  // wait half a second
                  try {
                      Thread.sleep(500);
                  } catch (Throwable th) {
                  }
  
                  // throw an exception if either timeout has been
                  // exceeded
                  long now = System.currentTimeMillis();
                  if (!starting) {
                      if ((now - startTime) / 1000 > startingTimeout) {
                          throw new Exception("Server startup did not begin within "
                                  + startingTimeout + " seconds");
                      }
                  }
                  if ((now - startTime) / 1000 > startupTimeout) {
                      throw new Exception("Server startup did not complete within "
                              + startupTimeout + " seconds");
                  }
  
                  // get next batch of messages
                  messages = _statusFile.getMessages(lastMessage);
                  if (messages.length > 0) {
                      lastMessage = messages[messages.length - 1];
                  }
              }
  
          }
  
      }
docs: Watch the status file and print details to standard output until the
  STARTED or STARTUP_FAILED state is encountered. If there are any problems
  reading the status file, a timeout is reached, or STARTUP_FAILED is
  encountered, this will throw an exception.