@Override
  public CompletableFuture<Long> flush(boolean sync) {
    CompletableFuture<Long> future = new CompletableFuture<>();
    ByteArrayOutputStream buffer = this.buffer;
    this.buffer = new ByteArrayOutputStream();
    executor.execute(() -> flush0(future, buffer, sync));
    return future;
  }
This flush0 method could only be called by single thread, so here we could safely overwrite
without any synchronization.
hbase-asyncfs/src/main/java/org/apache/hadoop/hbase/io/asyncfs/WrapperAsyncFSOutput.java