private void internalFlush() throws RetriesExhaustedWithDetailsException {
    // should get the future array before calling mutator.flush, otherwise we may hit an infinite
    // wait, since someone may add new future to the map after we calling the flush.
    CompletableFuture<?>[] toWait = futures.toArray(new CompletableFuture<?>[0]);
    mutator.flush();
    try {
      CompletableFuture.allOf(toWait).join();
    } catch (CompletionException e) {
      // just ignore, we will record the actual error in the errors field
      LOG.debug("Flush failed, you should get an exception thrown to your code", e);
    }
    if (!errors.isEmpty()) {
      RetriesExhaustedWithDetailsException error = makeError();
      listener.onException(error, this);
    }
  }
{@link BufferedMutator} implementation based on {@link AsyncBufferedMutator}.
hbase-client/src/main/java/org/apache/hadoop/hbase/client/BufferedMutatorOverAsyncBufferedMutator.java