code: public void waitForAsyncFlush() {
      long numAdded = asyncBatchesAdded.get();
  
      synchronized (this) {
        while (numAdded > asyncBatchesProcessed) {
          try {
            wait();
          } catch (InterruptedException e) {
            throw new RuntimeException(e);
          }
        }
      }
    }
docs: waits for all async mutations that were added before this was called to be flushed. Does not
  wait for async mutations added after call.