public void blockLocationInfoExpiresIfNeeded ( ) { if ( blkLocInfoExpireTimeout < 0 ) { return ; } long timeNow = System . currentTimeMillis ( ) ; if ( timeBlkLocInfoExpire < timeNow ) { this . writeLock ( ) ; try { long newTimeBlockExpire = Long . MAX_VALUE ; List < LocatedBlock > listToRemove = new ArrayList < LocatedBlock > ( ) ; for ( LocatedBlock lb : blkLocInfoExpireMap . keySet ( ) ) { long expireTime = blkLocInfoExpireMap . get ( lb ) ; if ( expireTime < timeNow ) { if ( DFSClient . LOG . isDebugEnabled ( ) ) { DFSClient . LOG . debug ( "Expire cached block location for " + lb ) ; } listToRemove . add ( lb ) ; } else if ( expireTime < newTimeBlockExpire ) { newTimeBlockExpire = expireTime ; } else { } } super . getLocatedBlocks ( ) . removeAll ( listToRemove ) ; for ( LocatedBlock lb : listToRemove ) { blkLocInfoExpireMap . remove ( lb ) ; } this . timeBlkLocInfoExpire = newTimeBlockExpire ; } finally { this . writeUnlock ( ) ; } } }
Deprecate block location information that has lived for too long