Пример #1
0
  @Override
  public void setConf(Configuration newConf) {
    this.conf = (CoronaConf) newConf;
    nodeExpiryInterval = conf.getNodeExpiryInterval();
    if (this.expireNodesThread != null) {
      this.expireNodesThread.interrupt();
    }

    loadManager = new LoadManager(this);
    topologyCache = new TopologyCache(conf);
    cpuToResourcePartitioning = conf.getCpuToResourcePartitioning();

    for (Map.Entry<Integer, Map<ResourceType, Integer>> entry :
        cpuToResourcePartitioning.entrySet()) {
      for (ResourceType type : entry.getValue().keySet()) {
        if (!typeToIndices.containsKey(type)) {
          typeToIndices.put(type, new RunnableIndices(type));
        }
      }
    }
    resourceLimit.setConf(conf);

    faultManager.setConf(conf);
  }
Пример #2
0
 /**
  * Check if a node has enough resources.
  *
  * @param node The node
  * @return A boolean indicating if it has enough resources.
  */
 public boolean hasEnoughResource(ClusterNode node) {
   return resourceLimit.hasEnoughResource(node);
 }