Updated Branches:
  refs/heads/master 2f570f5f8 -> a1495e382

ACCUMULO-1706 check for error on sysout

Checking for error conditions inside of loops that use sysout in PrintInfo and 
FindOfflineTablets.


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

Branch: refs/heads/master
Commit: a1495e3829880c64fdf5eb1eb3bcc072b79701d1
Parents: 2f570f5
Author: Mike Drob <md...@mdrob.com>
Authored: Wed Oct 23 23:47:11 2013 -0400
Committer: Mike Drob <md...@mdrob.com>
Committed: Sun Oct 27 14:18:31 2013 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java | 4 ++++
 .../java/org/apache/accumulo/server/util/FindOfflineTablets.java | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/a1495e38/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java 
b/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
index 0dfda0d..899a5cd 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
@@ -101,6 +101,10 @@ public class PrintInfo {
           System.out.println(String.format("%11.0f : %10d %6.2f%%", 
Math.pow(10, i), countBuckets[i], sizeBuckets[i] * 100. / totalSize));
         }
       }
+      
+      // If the output stream has closed, there is no reason to keep going.
+      if (System.out.checkError())
+        return;
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/a1495e38/server/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
----------------------------------------------------------------------
diff --git 
a/server/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java 
b/server/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
index f5dbdd6..6718a4f 100644
--- 
a/server/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
+++ 
b/server/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
@@ -115,8 +115,8 @@ public class FindOfflineTablets {
   
   private static int checkTablets(Iterator<TabletLocationState> scanner, 
LiveTServerSet tservers) {
     int offline = 0;
-
-    while (scanner.hasNext()) {
+    
+    while (scanner.hasNext() && !System.out.checkError()) {
       TabletLocationState locationState = scanner.next();
       TabletState state = locationState.getState(tservers.getCurrentServers());
       if (state != null && state != TabletState.HOSTED

Reply via email to