src/main/java/org/apache/hadoop/hdfs/server/namenode/cache/CachedDirectories.java
public void analyze(
      NameNodeLoader nnLoader, Map<String, Long> countMap, Map<String, Long> diskspaceMap) {
    long start = System.currentTimeMillis();

    /* Make an in-mem copy of the cachedDirs so we can parallelize the stream. */
    if (cachedDirs.size() > 0) {
      HashSet<String> inMemCachedDirsCopy = new HashSet<>(cachedDirs);
      Map<String, ContentSummary> contentSummaries =
          inMemCachedDirsCopy
              .parallelStream()
              .collect(Collectors.toMap(Function.identity(), nnLoader::getContentSummary));
      for (Entry<String, ContentSummary> entry : contentSummaries.entrySet()) {
        if (entry.getKey() == null || entry.getValue() == null) {
          continue;
        }
        countMap.put(entry.getKey(), entry.getValue().getFileCount());
        diskspaceMap.put(entry.getKey(), entry.getValue().getSpaceConsumed());
      }
    }

    long end = System.currentTimeMillis();
    LOG.info(
        "Performed cached directory analysis using getContentSummary calls in: "
            + (end - start)
            + "ms.");
  }
/**
   * Call to perform analysis across set of cached dirs.
   *
   * @param nnLoader the namenodeLoader of the NNA instance
   * @param countMap map of dir -> file count to add to
   * @param diskspaceMap map of dir -> diskspace to add to
   */
Call to perform analysis across set of cached dirs.
@param nnLoader the namenodeLoader of the NNA instance
@param countMap map of dir -> file count to add to
@param diskspaceMap map of dir -> diskspace to add to
Call to perform analysis across set of cached dirs . @param nnLoader the namenodeLoader of the NNA instance @param countMap map of dir - > file count to add to @param diskspaceMap map of dir - > diskspace to add to
public void analyze(
      NameNodeLoader nnLoader, Map<String, Long> countMap, Map<String, Long> diskspaceMap) {
    long start = System.currentTimeMillis();
    /* Make an in-mem copy of the cachedDirs so we can parallelize the stream. */
    if (cachedDirs.size() > 0) {
      HashSet<String> inMemCachedDirsCopy = new HashSet<>(cachedDirs);
      Map<String, ContentSummary> contentSummaries =
          inMemCachedDirsCopy
              .parallelStream()
              .collect(Collectors.toMap(Function.identity(), nnLoader::getContentSummary));
      for (Entry<String, ContentSummary> entry : contentSummaries.entrySet()) {
        if (entry.getKey() == null || entry.getValue() == null) {
          continue;
        }
        countMap.put(entry.getKey(), entry.getValue().getFileCount());
        diskspaceMap.put(entry.getKey(), entry.getValue().getSpaceConsumed());
      }
    }
    long end = System.currentTimeMillis();
    LOG.info(
        "Performed cached directory analysis using getContentSummary calls in: "
            + (end - start)
            + "ms.");
  }
public void analyze ( NameNodeLoader nnLoader , Map < String , Long > countMap , Map < String , Long > diskspaceMap ) { long start = System . currentTimeMillis ( ) ; /* Make an in-mem copy of the cachedDirs so we can parallelize the stream. */ if ( cachedDirs . size ( ) > 0 ) { HashSet < String > inMemCachedDirsCopy = new HashSet < > ( cachedDirs ) ; Map < String , ContentSummary > contentSummaries = inMemCachedDirsCopy . parallelStream ( ) . collect ( Collectors . toMap ( Function . identity ( ) , nnLoader :: getContentSummary ) ) ; for ( Entry < String , ContentSummary > entry : contentSummaries . entrySet ( ) ) { if ( entry . getKey ( ) == null || entry . getValue ( ) == null ) { continue ; } countMap . put ( entry . getKey ( ) , entry . getValue ( ) . getFileCount ( ) ) ; diskspaceMap . put ( entry . getKey ( ) , entry . getValue ( ) . getSpaceConsumed ( ) ) ; } } long end = System . currentTimeMillis ( ) ; LOG . info ( "Performed cached directory analysis using getContentSummary calls in: " + ( end - start ) + "ms." ) ; }
Call to perform analysis across set of cached dirs.
Call to perform analysis across set of cached dirs .