private static CompletableFuture<Boolean> completeCheckTableState(
    CompletableFuture<Boolean> future, Optional<TableState> tableState, Throwable error,
    TableState.State targetState, TableName tableName) {
    if (error != null) {
      future.completeExceptionally(error);
    } else {
      if (tableState.isPresent()) {
        future.complete(tableState.get().inStates(targetState));
      } else {
        future.completeExceptionally(new TableNotFoundException(tableName));
      }
    }
    return future;
  }
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