Repository: cassandra
Updated Branches:
  refs/heads/trunk 2a6aa8cfb -> bcbb53b7d


close log file stream


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

Branch: refs/heads/trunk
Commit: bcbb53b7deb9d45a2833eb4755a2f39860ae05b6
Parents: 2a6aa8c
Author: Dave Brosius <[email protected]>
Authored: Wed Dec 30 21:28:54 2015 -0500
Committer: Dave Brosius <[email protected]>
Committed: Wed Dec 30 21:28:54 2015 -0500

----------------------------------------------------------------------
 .../apache/cassandra/stress/StressGraph.java    | 34 ++++++++++----------
 1 file changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/bcbb53b7/tools/stress/src/org/apache/cassandra/stress/StressGraph.java
----------------------------------------------------------------------
diff --git a/tools/stress/src/org/apache/cassandra/stress/StressGraph.java 
b/tools/stress/src/org/apache/cassandra/stress/StressGraph.java
index 4e7fd12..ebaa0ae 100644
--- a/tools/stress/src/org/apache/cassandra/stress/StressGraph.java
+++ b/tools/stress/src/org/apache/cassandra/stress/StressGraph.java
@@ -234,28 +234,28 @@ public class StressGraph
 
     private JSONObject createJSONStats(JSONObject json)
     {
-        JSONArray stats;
-        if (json == null)
+        try (InputStream logStream = new 
FileInputStream(stressSettings.graph.temporaryLogFile))
         {
-            json = new JSONObject();
-            stats = new JSONArray();
-        }
-        else
-        {
-            stats = (JSONArray) json.get("stats");
-        }
+            JSONArray stats;
+            if (json == null)
+            {
+                json = new JSONObject();
+                stats = new JSONArray();
+            }
+            else
+            {
+                stats = (JSONArray) json.get("stats");
+            }
 
-        try
-        {
-            stats = parseLogStats(new 
FileInputStream(stressSettings.graph.temporaryLogFile), stats);
+            stats = parseLogStats(logStream, stats);
+
+            json.put("title", stressSettings.graph.title);
+            json.put("stats", stats);
+            return json;
         }
-        catch (FileNotFoundException e)
+        catch (IOException e)
         {
             throw new RuntimeException(e);
         }
-
-        json.put("title", stressSettings.graph.title);
-        json.put("stats", stats);
-        return json;
     }
 }

Reply via email to