Repository: ambari Updated Branches: refs/heads/trunk 98b55c911 -> 1ec095842
AMBARI-5966. Broken /api/v1/requests. (mpapirkovskyy) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1ec09584 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1ec09584 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1ec09584 Branch: refs/heads/trunk Commit: 1ec0958424efee8ee1b0088141301d8c577b9709 Parents: 98b55c9 Author: Myroslav Papirkovskyy <mpapyrkovs...@hortonworks.com> Authored: Fri May 30 23:01:01 2014 +0300 Committer: Myroslav Papirkovskyy <mpapyrkovs...@hortonworks.com> Committed: Fri May 30 23:01:01 2014 +0300 ---------------------------------------------------------------------- .../server/actionmanager/ActionScheduler.java | 34 ++++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/1ec09584/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java index 2030163..ea3727b 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java @@ -270,22 +270,28 @@ class ActionScheduler implements Runnable { //Multimap is analog of Map<Object, List<Object>> but allows to avoid nested loop ListMultimap<String, ServiceComponentHostEvent> eventMap = formEventMap(s, commandsToStart); - LOG.debug("==> processing {} serviceComponentHostEvents...", eventMap.size()); - List<ServiceComponentHostEvent> failedEvents = - fsmObject.getCluster(s.getClusterName()).processServiceComponentHostEvents(eventMap); - LOG.debug("==> {} events failed.", failedEvents.size()); - List<ExecutionCommand> commandsToAbort = new ArrayList<ExecutionCommand>(); - - for (Iterator<ExecutionCommand> iterator = commandsToUpdate.iterator(); iterator.hasNext(); ) { - ExecutionCommand cmd = iterator.next(); - for (ServiceComponentHostEvent event : failedEvents) { - if (StringUtils.equals(event.getHostName(), cmd.getHostname()) && - StringUtils.equals(event.getServiceComponentName(), cmd.getRole())) { - iterator.remove(); - commandsToAbort.add(cmd); - break; + if (!eventMap.isEmpty()) { + LOG.debug("==> processing {} serviceComponentHostEvents...", eventMap.size()); + Cluster cluster = fsmObject.getCluster(s.getClusterName()); + if (cluster != null) { + List<ServiceComponentHostEvent> failedEvents = + cluster.processServiceComponentHostEvents(eventMap); + LOG.debug("==> {} events failed.", failedEvents.size()); + + for (Iterator<ExecutionCommand> iterator = commandsToUpdate.iterator(); iterator.hasNext(); ) { + ExecutionCommand cmd = iterator.next(); + for (ServiceComponentHostEvent event : failedEvents) { + if (StringUtils.equals(event.getHostName(), cmd.getHostname()) && + StringUtils.equals(event.getServiceComponentName(), cmd.getRole())) { + iterator.remove(); + commandsToAbort.add(cmd); + break; + } + } } + } else { + LOG.warn("There was events to process but cluster {} not found", s.getClusterName()); } }