diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/AMRMClientImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/AMRMClientImpl.java index 3221661..3ed43b0 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/AMRMClientImpl.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/AMRMClientImpl.java @@ -664,15 +664,20 @@ public synchronized int getClusterNodeCount() { List> list = new LinkedList>(); RemoteRequestsTable remoteRequestsTable = getTable(0); - List> matchingRequests = - remoteRequestsTable.getMatchingRequests(priority, resourceName, - executionType, capability); - // If no exact match. Container may be larger than what was requested. - // get all resources <= capability. map is reverse sorted. - for (ResourceRequestInfo resReqInfo : matchingRequests) { - if (canFit(resReqInfo.remoteRequest.getCapability(), capability) && - !resReqInfo.containerRequests.isEmpty()) { - list.add(resReqInfo.containerRequests); + + if (null != remoteRequestsTable) { + List> matchingRequests = + remoteRequestsTable.getMatchingRequests(priority, resourceName, + executionType, capability); + if (null != matchingRequests) { + // If no exact match. Container may be larger than what was requested. + // get all resources <= capability. map is reverse sorted. + for (ResourceRequestInfo resReqInfo : matchingRequests) { + if (canFit(resReqInfo.remoteRequest.getCapability(), capability) && + !resReqInfo.containerRequests.isEmpty()) { + list.add(resReqInfo.containerRequests); + } + } } } // no match found