Esempio n. 1
0
  /**
   * Remove one application type from the node. Happens when the daemon responsible for handling
   * this application type on the node goes down
   *
   * @param node the node
   * @param type the type of the resource
   * @return the list of grants that belonged to the application on this node
   */
  protected Set<ClusterNode.GrantId> deleteAppFromNode(ClusterNode node, ResourceType type) {
    synchronized (node) {
      if (node.deleted) {
        return null;
      }

      nameToApps.remove(node.getName());
      RunnableIndices r = typeToIndices.get(type);
      r.deleteRunnable(node);

      return node.getGrants(type);
    }
  }
Esempio n. 2
0
  /**
   * Delete the node from the cluster. This happens when the node times out or is being
   * decommissioned.
   *
   * @param node the node to remove
   * @return the list of grants that are running on the node
   */
  protected Set<ClusterNode.GrantId> deleteNode(ClusterNode node) {
    synchronized (node) {
      if (node.deleted) {
        return null;
      }

      node.deleted = true;
      // 1: primary
      nameToNode.remove(node.getName());
      faultManager.deleteNode(node.getName());
      nameToApps.remove(node.getName());
      hostsToSessions.remove(node);
      setAliveDeadMetrics();

      // 2: update runnable index
      for (RunnableIndices r : typeToIndices.values()) {
        r.deleteRunnable(node);
      }
      return node.getGrants();
    }
  }