Sfoglia il codice sorgente

AMBARI-6105. Request and Stage should not throw RuntimeException when cluster could not be loaded (ncole)

Nate Cole 11 anni fa
parent
commit
37739ac70c

+ 4 - 6
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Request.java

@@ -76,9 +76,8 @@ public class Request {
       try {
         this.clusterName = clusters.getClusterById(this.clusterId).getClusterName();
       } catch (AmbariException e) {
-        String message = String.format("Cluster with id=%s not found", clusterId);
-        LOG.error(message);
-        throw new RuntimeException(message);
+        LOG.debug("Could not load cluster with id {}, the cluster may have been removed for request {}",
+            clusterId, Long.valueOf(requestId));
       }
     }
   }
@@ -148,9 +147,8 @@ public class Request {
       try {
         this.clusterName = clusters.getClusterById(this.clusterId).getClusterName();
       } catch (AmbariException e) {
-        String message = String.format("Cluster with id %s not found", this.clusterId);
-        LOG.error(message);
-        throw new RuntimeException(message);
+        LOG.debug("Could not load cluster with id {}, the cluster may have been removed for request {}",
+            Long.valueOf(clusterId), Long.valueOf(requestId));
       }
     }
 

+ 2 - 4
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Stage.java

@@ -102,10 +102,8 @@ public class Stage {
       try {
         clusterName = clusters.getClusterById(clusterId).getClusterName();
       } catch (Exception e) {
-        String message = String.format("Could not load cluster with id %s",
-            Long.valueOf(clusterId));
-        LOG.error(message);
-        throw new RuntimeException(message, e);
+        LOG.debug("Could not load cluster with id {}, the cluster may have been removed for stage {}",
+            Long.valueOf(clusterId), Long.valueOf(stageId));
       }
     }