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 2013/01/26 06:08:48 UTC

svn commit: r1438849 - /accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/DebugIterator.java

Author: elserj
Date: Sat Jan 26 05:08:47 2013
New Revision: 1438849

URL: http://svn.apache.org/viewvc?rev=1438849&view=rev
Log:
ACCUMULO-986 Override next(), implement OptionDescriber for the shell, and default `prefix` to this.hashCode if it's not set by the time init() gets called.

Modified:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/DebugIterator.java

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/DebugIterator.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/DebugIterator.java?rev=1438849&r1=1438848&r2=1438849&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/DebugIterator.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/DebugIterator.java Sat Jan 26 05:08:47 2013
@@ -26,7 +26,7 @@ import org.apache.accumulo.core.data.Ran
 import org.apache.accumulo.core.data.Value;
 import org.apache.log4j.Logger;
 
-public class DebugIterator extends WrappingIterator {
+public class DebugIterator extends WrappingIterator implements OptionDescriber {
   
   private String prefix;
   
@@ -74,9 +74,31 @@ public class DebugIterator extends Wrapp
     log.debug(prefix + " seek(" + range + ", " + columnFamilies + ", " + inclusive + ")");
     super.seek(range, columnFamilies, inclusive);
   }
+
+  @Override
+  public void next() throws IOException {
+    log.debug(prefix + " next()");
+    super.next();
+  }
   
   @Override
   public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException {
+    log.debug("init(" + source + ", " + options + ", " + env + ")");
+
+    if (null == prefix) {
+      prefix = String.format("0x%08X", this.hashCode());
+    }
+
     super.init(source, options, env);
   }
+
+  @Override
+  public IteratorOptions describeOptions() {
+    return new IteratorOptions("debug", DebugIterator.class.getSimpleName() + " prints debug information on each SortedKeyValueIterator method invocation", null, null);
+  }
+
+  @Override
+  public boolean validateOptions(Map<String,String> options) {
+    return true;
+  }
 }