[SPARK-3571] Spark standalone cluster mode doesn't work.

I think, this issue is caused by #1106
I think the correct thing to do here is keep a counter that keeps track of how many workers we've looked at so far, then the while loop would look like:

```
var numWorkersVisited = 0
while (numWorkersVisited < numWorkersAlive && !launched) {
  ...
  numWorkersVisited += 1
}
```