code: public int getAllocatedCpuForType(ResourceType type) {
      int total = 0;
  
      for (ClusterNode node: nameToNode.values()) {
        synchronized (node) {
          if (node.deleted) {
            continue;
          }
          total += node.getAllocatedCpuForType(type);
        }
      }
      return total;
    }
docs: Find allocation for a resource type.
  @param type The resource type.
  @return The allocation.