code: public synchronized ReturnCode waitForStop() {
  
          // if the lock is null or is invalid, the lock could not be obtained within the timeout
          if (!getServerLock()) {
              serverLock = null;
              lockFileChannel = null;
              System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("error.stopServerError"),
                                                      serverName, lockFile.getAbsolutePath()));
              return ReturnCode.ERROR_SERVER_STOP;
          }
  
          releaseServerLock();
          return ReturnCode.OK;
      }
docs: Wait until the server lock file can be obtained: Used when stopping
  the server to wait until the server has terminated.
  <p>
  This is a separate process using the attach API to stop the server.
  
  @return {@link ReturnCode#OK} if server lock file can be obtained within
  3 seconds (see {@link #getServerLock()}, will otherwise
  return {@link ReturnCode#ERROR_SERVER_STOP}