code: private ResourceGrant commitMatchedResource(
        Session session, MatchedPair pair) {
      ResourceGrant grant = null;
      ResourceRequestInfo req = pair.req;
      ClusterNode node = pair.node;
      String appInfo = nodeManager.getAppInfo(node, type);
      if (appInfo != null) {
        if (nodeManager.addGrant(node, session.getSessionId(), req)) {
          // if the nodemanager can commit this grant - we are done
          // the commit can fail if the node has been deleted
          grant = new ResourceGrant(req.getId(), node.getName(),
            node.getAddress(), ClusterManager.clock.getTime(), req.getType());
          grant.setAppInfo(appInfo);
          sessionManager.grantResource(session, req, grant);
        }
      }
      if (nodeSnapshot != null) {
        synchronized (node) {
          if (node.deleted) {
            nodeSnapshot.removeNode(node);
          } else if (!node.checkForGrant(Utilities.getUnitResourceRequest(type),
            nodeManager.getResourceLimit())) {
            nodeSnapshot.removeNode(node);
          }
        }
      }
      return grant;
    }
docs: Given a session and match of request-node, perform a "transaction commit"
  @param session The session
  @param pair The pair of (request, node)
  @return The resource grant: non-null if the "commit" was successful, null
  otherwise.