You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2015/02/03 00:14:32 UTC

[3/6] accumulo git commit: ACCUMULO-3556 Improve "scanner closed" error message.

ACCUMULO-3556 Improve "scanner closed" error message.

When a client sees a "scanner closed" exception come out
of the BatchScanner impl, it is not intuitive that the
problem is within their code and not in Accumulo itself.
Provide a strong error message to inform the user that the
problem is in their code and not an Accumulo bug.


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

Branch: refs/heads/master
Commit: 4e8471a3fa115083f9e930b92388150a8095846a
Parents: 8b54f13
Author: Josh Elser <el...@apache.org>
Authored: Mon Feb 2 18:08:39 2015 -0500
Committer: Josh Elser <el...@apache.org>
Committed: Mon Feb 2 18:08:39 2015 -0500

----------------------------------------------------------------------
 .../core/client/impl/TabletServerBatchReaderIterator.java    | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/4e8471a3/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
index 894616e..b23008e 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
@@ -208,8 +208,12 @@ public class TabletServerBatchReaderIterator implements Iterator<Entry<Key,Value
           else
             throw new RuntimeException(fatalException);
 
-        if (queryThreadPool.isShutdown())
-          throw new RuntimeException("scanner closed");
+        if (queryThreadPool.isShutdown()) {
+          String shortMsg = "The BatchScanner was unexpectedly closed while this Iterator was still in use.";
+          log.error(shortMsg + " Ensure that a reference to the BatchScanner is retained so that it can be closed when this Iterator is exhausted."
+              + " Not retaining a reference to the BatchScanner guarantees that you are leaking threads in your client JVM.");
+          throw new RuntimeException(shortMsg + " Ensure proper handling of the BatchScanner.");
+        }
 
         batchIterator = batch.iterator();
         return batch != LAST_BATCH;