private void deleteTable ( String tableName ) { m_logger . info ( "Deleting table: {}" , tableName ) ; try { m_ddbClient . deleteTable ( new DeleteTableRequest ( tableName ) ) ; for ( int seconds = 0 ; seconds < 10 ; seconds ++ ) { try { m_ddbClient . describeTable ( tableName ) ; Thread . sleep ( 1000 ) ; } catch ( ResourceNotFoundException e ) { break ; // Success } // All other exceptions passed to outer try/catch } } catch ( ResourceNotFoundException e ) { // Already deleted. } catch ( Exception e ) { throw new RuntimeException ( "Error deleting table: " + tableName , e ) ; } }
Delete the given table and wait for it to be deleted .