accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [6/7] git commit: ACCUMULO-3157 ACCUMULO-3158 Fix compilation issues and ensure scanner is closed.
Date Mon, 22 Sep 2014 22:33:26 GMT
ACCUMULO-3157 ACCUMULO-3158 Fix compilation issues and ensure scanner is closed.


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

Branch: refs/heads/1.6.2-SNAPSHOT
Commit: 53705e7e863721a36237dc5a3646c473e0e5e6eb
Parents: 9b99db2
Author: Josh Elser <elserj@apache.org>
Authored: Mon Sep 22 17:39:19 2014 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Mon Sep 22 17:39:19 2014 -0400

----------------------------------------------------------------------
 .../server/util/FindOfflineTablets.java         | 34 ++++++++++----------
 1 file changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/53705e7e/server/base/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
b/server/base/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
index 8f78488..721d4e2 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
@@ -106,27 +106,27 @@ public class FindOfflineTablets {
       range = new KeyExtent(new Text(tableId), null, null).toMetadataRange();
     }
 
-    Iterator<TabletLocationState> metaScanner = new MetaDataTableScanner(instance,
creds, range, MetadataTable.NAME);
-    return checkTablets(metaScanner, tservers);
+    MetaDataTableScanner metaScanner = new MetaDataTableScanner(instance, creds, range, MetadataTable.NAME);
+    try {
+      return checkTablets(metaScanner, tservers);
+    } finally {
+      metaScanner.close();
+    }
   }
 
   private static int checkTablets(Iterator<TabletLocationState> scanner, LiveTServerSet
tservers) {
     int offline = 0;
-    
-    try {
-      while (scanner.hasNext() && !System.out.checkError()) {
-        TabletLocationState locationState = scanner.next();
-        TabletState state = locationState.getState(tservers.getCurrentServers());
-        if (state != null && state != TabletState.HOSTED
-            && TableManager.getInstance().getTableState(locationState.extent.getTableId().toString())
!= TableState.OFFLINE) {
-          System.out.println(locationState + " is " + state + "  #walogs:" + locationState.walogs.size());
-          offline++;
-        }
+
+    while (scanner.hasNext() && !System.out.checkError()) {
+      TabletLocationState locationState = scanner.next();
+      TabletState state = locationState.getState(tservers.getCurrentServers());
+      if (state != null && state != TabletState.HOSTED
+          && TableManager.getInstance().getTableState(locationState.extent.getTableId().toString())
!= TableState.OFFLINE) {
+        System.out.println(locationState + " is " + state + "  #walogs:" + locationState.walogs.size());
+        offline++;
       }
-  
-      return offline;
-    } finally {
-      scanner.close();
-    } 
+    }
+
+    return offline;
   }
 }


Mime
View raw message