code: public TableDescription waitForDelete() throws InterruptedException {
          final String indexName = getIndexName();
          retry: for (;;) {
              final TableDescription desc = getTable().waitForActive();
              List<GlobalSecondaryIndexDescription> list = desc.getGlobalSecondaryIndexes();
              if (list != null) {
                  for (GlobalSecondaryIndexDescription d: list) {
                      if (d.getIndexName().equals(indexName)) {
                          final String status = d.getIndexStatus();
                          if (IndexStatus.fromValue(status) == IndexStatus.DELETING) {
                              Thread.sleep(SLEEP_TIME_MILLIS);
                              continue retry;
                          }
                          throw new IllegalArgumentException(
                              "Global Secondary Index " + indexName
                              + " is not being deleted (with status=" + status + ")");
                      }
                  }
              }
              return desc;
          }
      }
docs: A convenient blocking call that can be used, typically during index
  deletion on an active table, to wait for the index to become deleted by
  polling the table every 5 seconds.
  <p>
  Currently online index 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 if this GSI has been deleted; or null if
  the underlying table has been deleted.
  
  @throws IllegalArgumentException if the table is being deleted, or if the
  GSI is not being deleted.
  @throws ResourceNotFoundException if the table doesn't exist