Get a map of pool infos to average wait times for first
resource of a resource type.
@param type Resource type
@return Map of pools into average first resource time
6326
public Map<PoolInfo, Long> getTypePoolInfoAveFirstWaitMs(ResourceType type) {
    Map<PoolInfo, WaitCount> poolInfoWaitCount =
        new HashMap<PoolInfo, WaitCount>();
    for (Session session : sessions.values()) {
      synchronized (session) {
        if (!session.isDeleted()) {
          Long wait = session.getTypeFirstWaitMs(type);
          if (wait == null) {
            continue;
          }

          WaitCount waitCount = poolInfoWaitCount.get(session.getPoolInfo());
          if (waitCount == null) {
            poolInfoWaitCount.put(session.getPoolInfo(),
                                  new WaitCount(wait));
          } else {
            waitCount.addWaitMsecs(wait);
          }
        }
      }
    }
    Map<PoolInfo, Long> poolInfoWaitMs =
        new HashMap<PoolInfo, Long>(poolInfoWaitCount.size());
    for (Map.Entry<PoolInfo, WaitCount> entry : poolInfoWaitCount.entrySet()) {
      poolInfoWaitMs.put(entry.getKey(), entry.getValue().getAverageWait());
    }
    return poolInfoWaitMs;
  }
641958
@Nullable static Map<String, Long> getTypeToTimeMap() {
    return typeToTimeMap != null ? typeToTimeMap.getMap() : null;
  }
146632
@Nullable
	@Override
	public String getMapping(Class<?> type) {

		String key = key(type, null);

		return MAPPINGS.computeIfAbsent(key, __ -> delegate.getMapping(type));
	}
622984
public static List<String> getTypeParameters(final String type) {
        if (type.charAt(0) != 'L')
            return emptyList();

        int lastStart = type.indexOf('<') + 1;
        final List<String> parameters = new ArrayList<>();

        if (lastStart > 0) {
            int depth = 0;
            for (int i = lastStart; i < type.length() - 2; i++) {
                final char c = type.charAt(i);
                if (c == '<')
                    depth++;
                else if (c == '>')
                    depth--;
                else if (c == ';' && depth == 0) {
                    parameters.add(type.substring(lastStart, i + 1));
                    lastStart = i + 1;
                }
            }
        }
        return parameters;
    }
373433
@Override
	public LinkRelation getCollectionResourceRelFor(java.lang.Class<?> type) {

		LookupContext context = LookupContext.forCollectionResourceRelLookup(type);

		return providers.getRequiredPluginFor(context).getCollectionResourceRelFor(type);
	}
607903
public String getTreeResource(String type) {

        String result = m_treeType.get(type);
        if (result == null) {
            result = "/";
        }
        return result;
    }
1328555
public Optional<MapperInstance> getKeyDeserializer( JType type ) {
        return Optional.fromNullable( keyDeserializers.get( type.getQualifiedSourceName() ) );
    }
89564
private List<PoolMetadata> getPoolMetadataList() {
    Map<String, PoolMetadata> poolNameMetadataMap =
        new HashMap<String, PoolMetadata>();
    for (Map.Entry<ResourceType, SchedulerForType> schedulerEntry :
        schedulersForTypes.entrySet()) {
      for (Map.Entry<PoolInfo, PoolInfoMetrics> poolEntry :
          schedulerEntry.getValue().getPoolInfoMetrics().entrySet()) {
        ResourceMetadata resourceMetadata =
            poolEntry.getValue().getResourceMetadata();
        // Ignore any invalid pool metrics
        if (resourceMetadata == null) {
          continue;
        }
        String stringifiedPoolInfo =
            PoolInfo.createStringFromPoolInfo(poolEntry.getKey());
        PoolMetadata poolMetadata =
            poolNameMetadataMap.get(stringifiedPoolInfo);
        if (poolMetadata == null) {
          poolMetadata = new PoolMetadata(stringifiedPoolInfo);
          poolNameMetadataMap.put(stringifiedPoolInfo, poolMetadata);
        }
        poolMetadata.addResourceMetadata(schedulerEntry.getKey().toString(),
                                         resourceMetadata);
      }
    }
    return new ArrayList<PoolMetadata>(poolNameMetadataMap.values());
  }
223039
public CMISInfo getCMISInfo(final Class<? extends GraphObject> type) {

		try { return type.newInstance().getCMISInfo(); } catch (Throwable t) {}

		return null;
	}
715489
public List<String> getFreeNodesForType(ResourceType type) {
    ArrayList<String> freeNodes = new ArrayList<String>();
    for (Map.Entry<String, ClusterNode> entry: nameToNode.entrySet()) {
      ClusterNode node = entry.getValue();
      synchronized (node) {
        if (!node.deleted &&
            node.getMaxCpuForType(type) > node.getAllocatedCpuForType(type)) {
          freeNodes.add(entry.getKey() + ": " + node.getFree().toString());
        }
      }
    }
    return freeNodes;
  }
958011
public <T extends Mapping> T findMapping(MappingType type, Predicate<T> predicate)
    {
        T mapping = getMapping(type);
        if (mapping != null)
        {

            // check predicate: can invalidate the local mapping
            if (predicate != null)
            {
                mapping = (predicate.appliesTo(mapping)) ? mapping : null;
            }

            // complement the mapping (i.e. resource address at a higher level)
            if(mapping!=null && parent!=null)
            {
                Mapping parentMapping = parent.findMapping(type, predicate);
                if(parentMapping!=null)
                {
                    mapping.complementFrom(parentMapping);
                }
            }

        }

        if (mapping == null && parent != null)
        {
            mapping = (T) parent.findMapping(type, predicate);
        }

        return mapping;
    }
517878
public static Map<String, String> resourceType(String kind, Map<String, String> meta) {
        HashMap<String, String> authResource = new HashMap<String, String>();
        if (null != meta) {
            authResource.putAll(meta);
        }
        authResource.put(TYPE_FIELD, GENERIC_RESOURCE_TYPE_NAME);
        authResource.put(TYPE_KIND_FIELD, kind);
        return authResource;
    }
259275
public Optional<MapperInstance> getKeySerializer( JType type ) {
        return Optional.fromNullable( keySerializers.get( type.getQualifiedSourceName() ) );
    }
449962
public Map<String, ThreadPoolStatus> getStatusOfThreadPools(){
		Map<String, ThreadPoolStatus> result = new TreeMap<String, ThreadPoolStatus>();
		for (Map.Entry<String, ? extends ThreadPoolExecutor> entry: threadPools.entrySet()){
			ThreadPoolStatus status = new ThreadPoolStatus();
			status.setName(entry.getKey());
			ThreadPoolExecutor pool = entry.getValue();
			status.setActive(pool.getActiveCount());
			status.setKeepAliveSeconds(pool.getKeepAliveTime(TimeUnit.SECONDS));
			status.setLargestSize(pool.getLargestPoolSize());
			status.setMaxSize(pool.getMaximumPoolSize());
			status.setSize(pool.getPoolSize());
			status.setQueueLength(pool.getQueue().size());
			result.put(entry.getKey(), status);
		}
		return result;
	}
156851
public synchronized Map<String, Integer> getStats() {
    Map<String, Integer> stats = new HashMap<String, Integer>();
    for (int i = 0; i < mBuckets.size(); ++i) {
      final int bucketedSize = mBuckets.keyAt(i);
      final Bucket<V> bucket = mBuckets.valueAt(i);
      final String BUCKET_USED_KEY =
          PoolStatsTracker.BUCKETS_USED_PREFIX + getSizeInBytes(bucketedSize);
      stats.put(BUCKET_USED_KEY, bucket.getInUseCount());
    }

    stats.put(PoolStatsTracker.SOFT_CAP, mPoolParams.maxSizeSoftCap);
    stats.put(PoolStatsTracker.HARD_CAP, mPoolParams.maxSizeHardCap);
    stats.put(PoolStatsTracker.USED_COUNT, mUsed.mCount);
    stats.put(PoolStatsTracker.USED_BYTES, mUsed.mNumBytes);
    stats.put(PoolStatsTracker.FREE_COUNT, mFree.mCount);
    stats.put(PoolStatsTracker.FREE_BYTES, mFree.mNumBytes);

    return stats;
  }
191900
public V put(ResourceType type, PoolInfo poolInfo, V value) {
    Map<PoolInfo, V> poolInfoMap = typePoolInfoMap.get(type);
    if (poolInfoMap == null) {
      poolInfoMap = new HashMap<PoolInfo, V>();
      typePoolInfoMap.put(type, poolInfoMap);
    }
    return poolInfoMap.put(poolInfo, value);
  }
1175589
public int getRunningTasks(String poolName, TaskType type) {
    Map<String, Integer> runningMap = (type == TaskType.MAP ?
                                       poolRunningMaps : poolRunningReduces);
    return (runningMap.containsKey(poolName) ?
            runningMap.get(poolName) : 0);
  }