public Map getResourcesMap()

in server/src/jetbrains/buildServer/sharedResources/server/CachingProjectResourcesMap.java [36:59]


  public Map<String, Resource> getResourcesMap(@NotNull final SProject project) {
    final Map<String, Resource> resourcesMap = myCache.get(project.getProjectId());
    if (resourcesMap != null) return resourcesMap;

    Map<String, Resource> result = new HashMap<>();
    final List<SProject> projectPath = project.getProjectPath();
    for (SProject p : projectPath) {
      Map<String, Resource> cached = myCache.get(project.getProjectId());
      if (cached != null) {
        result.putAll(cached);
        continue;
      }

      final List<Resource> ownResources = myResources.getOwnResources(p);
      for (Resource r : ownResources) {
        result.put(r.getName(), r);
      }

      // store a copy of our intermediate result to the cache for the current project
      myCache.computeIfAbsent(p.getProjectId(), id -> new HashMap<>(result));
    }

    return result;
  }