code: private void waitForMoveCompletion() {
      boolean shouldWait;
      int waitedIterations = 0;
      do {
        shouldWait = false;
        for (BalancerDatanode target : plan.targets) {
          if (!target.isPendingQEmpty()) {
            shouldWait = true;
          }
        }
        if (shouldWait) {
          try {
            if (waitedIterations > MAX_WAIT_ITERATIONS) {
              for (BalancerDatanode target : plan.targets) {
                target.killPending();
              }
              continue;
            }
            waitedIterations++;
            Thread.sleep(blockMoveWaitTime);
          } catch (InterruptedException ignored) {
          }
        }
      } while (shouldWait);
    }
docs: /* wait for all block move confirmations
  by checking each target's pendingMove queue