private boolean scanFirstTime ( ) throws IOException { Map < String , MFile > newMap = new HashMap <> ( ) ; if ( ! hasScans ( ) ) { map = newMap ; return false ; } reallyScan ( newMap ) ; // deleteOld(newMap); // ?? hmmmmm LOOK this seems wrong; maintainence in background ?? generally collection doesnt exist // implement olderThan if ( olderThanInMsecs > 0 ) { long olderThan = System . currentTimeMillis ( ) - olderThanInMsecs ; // new files must be older than this. Iterator < MFile > iter = newMap . values ( ) . iterator ( ) ; // need iterator so we can remove() while ( iter . hasNext ( ) ) { MFile newFile = iter . next ( ) ; String path = newFile . getPath ( ) ; if ( newFile . getLastModified ( ) > olderThan ) { // the file is too new iter . remove ( ) ; logger . debug ( "{}: scan found new Dataset but its too recently modified = {}" , collectionName , path ) ; } } } map = newMap ; this . lastScanned = System . currentTimeMillis ( ) ; this . lastChanged . set ( this . lastScanned ) ; logger . debug ( "{} : initial scan found n datasets = {} " , collectionName , map . keySet ( ) . size ( ) ) ; return map . keySet ( ) . size ( ) > 0 ; }
only called from synch methods