private void legacyFlush(CompletableFuture<Void> future, TableName tableName,
    List<byte[]> columnFamilies) {
    addListener(tableExists(tableName), (exists, err) -> {
      if (err != null) {
        future.completeExceptionally(err);
      } else if (!exists) {
        future.completeExceptionally(new TableNotFoundException(tableName));
      } else {
        addListener(isTableEnabled(tableName), (tableEnabled, err2) -> {
          if (err2 != null) {
            future.completeExceptionally(err2);
          } else if (!tableEnabled) {
            future.completeExceptionally(new TableNotEnabledException(tableName));
          } else {
            Map<String, String> props = new HashMap<>();
            if (columnFamilies != null && !columnFamilies.isEmpty()) {
              props.put(HConstants.FAMILY_KEY_STR, Strings.JOINER
                .join(columnFamilies.stream().map(Bytes::toString).collect(Collectors.toList())));
            }
            addListener(
              execProcedure(FLUSH_TABLE_PROCEDURE_SIGNATURE, tableName.getNameAsString(), props),
              (ret, err3) -> {
                if (err3 != null) {
                  future.completeExceptionally(err3);
                } else {
                  future.complete(ret);
                }
              });
          }
        });
      }
    });
  }
Utility for completing passed TableState {@link CompletableFuture} <code>future</code> using
passed parameters. Sets error or boolean result ('true' if table matches the passed-in
targetState).
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java