code: public TableDescription waitForActiveOrDelete() throws InterruptedException {
          final Table table = getTable();
          final String indexName = getIndexName();
          retry: for (;;) {
              TableDescription desc = table.waitForActive();
              List<GlobalSecondaryIndexDescription> list = desc.getGlobalSecondaryIndexes();
              if (list != null) {
                  for (GlobalSecondaryIndexDescription d: desc.getGlobalSecondaryIndexes()) {
                      if (d.getIndexName().equals(indexName)) {
                          final String status = d.getIndexStatus();
                          if (IndexStatus.fromValue(status) == IndexStatus.ACTIVE)
                              return desc;
                          Thread.sleep(SLEEP_TIME_MILLIS);
                          continue retry;
                      }
                  }
              }
              return desc;
          }
      }
docs: A convenient blocking call that can be used to wait on an index until it
  has either become active or deleted (ie no longer exists) by polling the
  table every 5 seconds.
  <p>
  Currently online index creation/deletion is only supported for Global
  Secondary Index (GSI). The behavior of calling this method on a Local
  Secondary Index (LSI) would result in returning the latest table
  description.
  
  @return the table description when the index has become either active
  or deleted
  
  @throws IllegalArgumentException if the table is being deleted
  @throws ResourceNotFoundException if the table doesn't exist