public int updateQueue ( ) throws IOException { int added = 0 ; long lastMarkPoint = lastMark . getLastMark ( ) ; long currentMarkPoint = db . getCurrentMark ( ) ; if ( currentMarkPoint > lastMarkPoint ) { // TODO: touchy touchy... need transactions here to not have // state sync problems if something goes badly in this block.. // for example, it would be possible to constantly enqueue the // same files forever.. CloseableIterator < String > newNames = db . getNamesBetweenMarks ( lastMarkPoint , currentMarkPoint ) ; while ( newNames . hasNext ( ) ) { String newName = newNames . next ( ) ; LOGGER . info ( "Queued " + newName + " for indexing." ) ; queue . enqueue ( newName ) ; added ++ ; } newNames . close ( ) ; lastMark . setLastMark ( currentMarkPoint ) ; } return added ; }
Add new names to the IndexQueue .