public void deleteTable(String tableName) throws DataAccessException {
   DeleteTableRequest request = new DeleteTableRequest(tableName);
   try {
     ddb.deleteTable(request);
     try {
       int attempt = 0;
       TableDescription tableDescription = null;
       do {
         tableDescription =
             ddb.describeTable(new DescribeTableRequest().withTableName(tableName)).getTable();
         attempt++;
         try {
           Thread.sleep(200);
         } catch (InterruptedException e) {
         }
       } while (attempt < 1000);
       // if we got here it means there was no ResourceNotFoundException, so it was not deleted
       throw new DataStoreOperationException(
           "could not delete table "
               + tableName
               + ", current table description: "
               + tableDescription);
     } catch (ResourceNotFoundException e) {
       // this is good, it means table is actually deleted
       return;
     }
   } catch (AmazonClientException e) {
     throw new DataStoreOperationException("problem with table: " + tableName, e);
   }
 }
 private TableDescription waitTillTableState(String tableName, String desiredState) {
   int attempt = 0;
   TableDescription tableDescription = null;
   do {
     tableDescription =
         ddb.describeTable(new DescribeTableRequest().withTableName(tableName)).getTable();
     attempt++;
     try {
       Thread.sleep(200);
     } catch (InterruptedException e) {
     }
   } while (attempt < 1000 && !desiredState.equals(tableDescription.getTableStatus()));
   return tableDescription;
 }