ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-9771 AMS: ResultSpooler spill files are left behind in /tmp folder (dsen)
Date Wed, 25 Feb 2015 11:41:01 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 13b9bee46 -> 8211d7a44


AMBARI-9771 AMS: ResultSpooler spill files are left behind in /tmp folder (dsen)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8211d7a4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8211d7a4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8211d7a4

Branch: refs/heads/trunk
Commit: 8211d7a4451c5f3499d8374830131a47975e073d
Parents: 13b9bee
Author: Dmytro Sen <dsen@apache.org>
Authored: Tue Feb 24 19:57:14 2015 +0200
Committer: Dmytro Sen <dsen@apache.org>
Committed: Wed Feb 25 12:38:41 2015 +0200

----------------------------------------------------------------------
 .../metrics/timeline/PhoenixHBaseAccessor.java  | 54 +++++++++++++++-----
 1 file changed, 40 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8211d7a4/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
index af05d93..36f0ab9 100644
--- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
+++ b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/timeline/PhoenixHBaseAccessor.java
@@ -34,7 +34,6 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -408,6 +407,7 @@ public class PhoenixHBaseAccessor {
 
     Connection conn = getConnection();
     PreparedStatement stmt = null;
+    ResultSet rs = null;
     TimelineMetrics metrics = new TimelineMetrics();
 
     try {
@@ -416,14 +416,20 @@ public class PhoenixHBaseAccessor {
         stmt = getLatestMetricRecords(condition, conn, metrics);
       } else {
         stmt = PhoenixTransactSQL.prepareGetMetricsSqlStmt(conn, condition);
-
-        ResultSet rs = stmt.executeQuery();
+        rs = stmt.executeQuery();
         while (rs.next()) {
           appendMetricFromResultSet(metrics, condition, metricFunctions, rs);
         }
       }
 
     } finally {
+      if (rs != null) {
+        try {
+          rs.close();
+        } catch (SQLException e) {
+          // Ignore
+        }
+      }
       if (stmt != null) {
         try {
           stmt.close();
@@ -492,11 +498,21 @@ public class PhoenixHBaseAccessor {
       splitCondition.setCurrentMetric(metricName);
       stmt = PhoenixTransactSQL.prepareGetLatestMetricSqlStmt(conn,
         splitCondition);
-
-      ResultSet rs = stmt.executeQuery();
-      while (rs.next()) {
-        TimelineMetric metric = getLastTimelineMetricFromResultSet(rs);
-        metrics.getMetrics().add(metric);
+      ResultSet rs = null;
+      try {
+        rs = stmt.executeQuery();
+        while (rs.next()) {
+          TimelineMetric metric = getLastTimelineMetricFromResultSet(rs);
+          metrics.getMetrics().add(metric);
+        }
+      } finally {
+        if (rs != null) {
+          try {
+            rs.close();
+          } catch (SQLException e) {
+            // Ignore
+          }
+        }
       }
     }
 
@@ -601,12 +617,22 @@ public class PhoenixHBaseAccessor {
       splitCondition.setCurrentMetric(metricName);
       stmt = PhoenixTransactSQL.prepareGetLatestAggregateMetricSqlStmt(conn,
         splitCondition);
-
-      ResultSet rs = stmt.executeQuery();
-      while (rs.next()) {
-        TimelineMetric metric = getAggregateTimelineMetricFromResultSet(rs,
-          new Function());
-        metrics.getMetrics().add(metric);
+      ResultSet rs = null;
+      try {
+        rs = stmt.executeQuery();
+        while (rs.next()) {
+          TimelineMetric metric = getAggregateTimelineMetricFromResultSet(rs,
+            new Function());
+          metrics.getMetrics().add(metric);
+        }
+      } finally {
+        if (rs != null) {
+          try {
+            rs.close();
+          } catch (SQLException e) {
+            // Ignore
+          }
+        }
       }
     }
 


Mime
View raw message