private void checkTable ( ) { // Documentation says that "0 xxx" means data-aging is disabled. if ( m_retentionAge . getValue ( ) == 0 ) { m_logger . info ( "Data aging disabled for table: {}" , m_tableDef . getTableName ( ) ) ; return ; } m_logger . info ( "Checking expired objects for: {}" , m_tableDef . getTableName ( ) ) ; GregorianCalendar checkDate = new GregorianCalendar ( Utils . UTC_TIMEZONE ) ; GregorianCalendar expireDate = m_retentionAge . getExpiredDate ( checkDate ) ; int objsExpired = 0 ; String fixedQuery = buildFixedQuery ( expireDate ) ; String contToken = null ; StringBuilder uriParam = new StringBuilder ( ) ; do { uriParam . setLength ( 0 ) ; uriParam . append ( fixedQuery ) ; if ( ! Utils . isEmpty ( contToken ) ) { uriParam . append ( "&g=" ) ; uriParam . append ( contToken ) ; } ObjectQuery objQuery = new ObjectQuery ( m_tableDef , uriParam . toString ( ) ) ; SearchResultList resultList = SpiderService . instance ( ) . objectQuery ( m_tableDef , objQuery ) ; List < String > objIDs = new ArrayList <> ( ) ; for ( SearchResult result : resultList . results ) { objIDs . add ( result . id ( ) ) ; } if ( deleteBatch ( objIDs ) ) { contToken = resultList . continuation_token ; } else { contToken = null ; } objsExpired += objIDs . size ( ) ; reportProgress ( "Expired " + objsExpired + " objects" ) ; } while ( ! Utils . isEmpty ( contToken ) ) ; m_logger . info ( "Deleted {} objects for {}" , objsExpired , m_tableDef . getTableName ( ) ) ; }
Scan the given table for expired objects relative to the given date .