private boolean domainsAvailable ( ) { domainsFileLock . readLock ( ) . lock ( ) ; logger . trace ( "LOCK readlock" ) ; try { File f = getDomainFile ( ) ; if ( ! f . exists ( ) || f . length ( ) <= 0 ) return false ; // Re-download old copies of "latest" if ( updateFrequency != null && requestedVersion == DEFAULT_VERSION ) { long mod = f . lastModified ( ) ; // Time of last update Date lastUpdate = new Date ( ) ; Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( lastUpdate ) ; cal . add ( Calendar . DAY_OF_WEEK , - updateFrequency ) ; long updateTime = cal . getTimeInMillis ( ) ; // Check if file predates last update if ( mod < updateTime ) { logger . info ( "{} is out of date." , f ) ; return false ; } } return true ; } finally { logger . trace ( "UNLOCK readlock" ) ; domainsFileLock . readLock ( ) . unlock ( ) ; } }
Checks that the domains file has been downloaded