@Override
  public CompletableFuture<Boolean> isTableAvailable(TableName tableName) {
    if (TableName.isMetaTableName(tableName)) {
      return connection.registry.getMetaRegionLocations().thenApply(locs -> Stream
        .of(locs.getRegionLocations()).allMatch(loc -> loc != null && loc.getServerName() != null));
    }
    CompletableFuture<Boolean> future = new CompletableFuture<>();
    addListener(isTableEnabled(tableName), (enabled, error) -> {
      if (error != null) {
        if (error instanceof TableNotFoundException) {
          future.complete(false);
        } else {
          future.completeExceptionally(error);
        }
        return;
      }
      if (!enabled) {
        future.complete(false);
      } else {
        addListener(ClientMetaTableAccessor.getTableHRegionLocations(metaTable, tableName),
          (locations, error1) -> {
            if (error1 != null) {
              future.completeExceptionally(error1);
              return;
            }
            List<HRegionLocation> notDeployedRegions = locations.stream()
              .filter(loc -> loc.getServerName() == null).collect(Collectors.toList());
            if (notDeployedRegions.size() > 0) {
              if (LOG.isDebugEnabled()) {
                LOG.debug("Table " + tableName + " has " + notDeployedRegions.size() + " regions");
              }
              future.complete(false);
              return;
            }
            future.complete(true);
          });
      }
    });
    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