You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/04/04 16:46:42 UTC

[GitHub] [accumulo] ctubbsii commented on a diff in pull request #2600: Create IteratorBuilder to expose potential bugs

ctubbsii commented on code in PR #2600:
URL: https://github.com/apache/accumulo/pull/2600#discussion_r841943913


##########
core/src/main/java/org/apache/accumulo/core/conf/IteratorBuilder.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.core.conf;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.accumulo.core.dataImpl.thrift.IterInfo;
+import org.apache.accumulo.core.iterators.IteratorEnvironment;
+
+/**
+ * Builder class for setting up the iterator stack.
+ */
+public class IteratorBuilder {
+  Collection<IterInfo> iters;
+  Map<String,Map<String,String>> iterOpts;
+  IteratorEnvironment iteratorEnvironment;
+  boolean useAccumuloClassLoader;
+  String context = null;
+  boolean useClassCache = false;
+
+  IteratorBuilder() {}
+
+  /**
+   * Start building the iterator builder.
+   */
+  public static IteratorBuilderImpl builder(Collection<IterInfo> iters) {
+    return new IteratorBuilderImpl(iters);
+  }
+
+  public interface IteratorBuilderEnv {
+    /**
+     * Set the iteratorEnvironment.
+     */
+    IteratorBuilderCassLoader env(IteratorEnvironment iteratorEnvironment);
+  }
+
+  public interface IteratorBuilderCassLoader {
+    /**
+     * Pass true to useAccumuloClassLoader or false otherwise. If true, a context is required.
+     */
+    IteratorBuilderOptions useClassLoader(boolean useAccumuloClassLoader);

Review Comment:
   Instead of passing in a true/false, could supply the context here. Supplying a context implies true.
   
   ```suggestion
       IteratorBuilderOptions useClassLoaderContext(String context);
   ```
   
   And, class loading always uses a class loader, so it's a bit confusing if the value is false.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org