code: public void flush() {
      for (Batch batch : batches.values()) {
        Collection<Batch> subbatches = batch.split();
        for (Batch miniBatch : subbatches) {
          threadPool.submit(miniBatch);
        }
      }
      batches.clear();
    }
docs: Sends all remaining requests to the server. This method does not wait for the method to
  complete.