tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ok...@apache.org
Subject incubator-tinkerpop git commit: Really nailed what LocalBarrier 'is'. Created NoOpBarrierStep which does LocalBarrier more intelligently than LambdaCollectingBarrierStep(noOp). AggregateStep updated to LocalBarrier API. Much more stylin' and easy to use.
Date Fri, 04 Mar 2016 16:02:57 GMT
Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1192 3c05ba578 -> 3da67b9b6


Really nailed what LocalBarrier 'is'. Created NoOpBarrierStep which does LocalBarrier more
intelligently than LambdaCollectingBarrierStep(noOp). AggregateStep updated to LocalBarrier
API. Much more stylin' and easy to use.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/3da67b9b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/3da67b9b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/3da67b9b

Branch: refs/heads/TINKERPOP-1192
Commit: 3da67b9b60b951c6d9f1cff83742cf718ae8ed68
Parents: 3c05ba5
Author: Marko A. Rodriguez <okrammarko@gmail.com>
Authored: Fri Mar 4 09:02:50 2016 -0700
Committer: Marko A. Rodriguez <okrammarko@gmail.com>
Committed: Fri Mar 4 09:02:50 2016 -0700

----------------------------------------------------------------------
 .../traversal/TraversalVertexProgram.java       |   4 +-
 .../computer/traversal/TraverserExecutor.java   |  43 ++++---
 .../traversal/dsl/graph/GraphTraversal.java     |   3 +-
 .../process/traversal/step/LocalBarrier.java    |  12 +-
 .../step/map/LambdaCollectingBarrierStep.java   |   4 +
 .../traversal/step/map/NoOpBarrierStep.java     | 117 +++++++++++++++++++
 .../step/sideEffect/AggregateStep.java          |  56 ++++++---
 .../finalization/LazyBarrierStrategy.java       |  15 +--
 .../traversal/step/map/MatchStepTest.java       |  14 ++-
 9 files changed, 213 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3da67b9b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
index 9a3adea..4683177 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraversalVertexProgram.java
@@ -272,9 +272,9 @@ public final class TraversalVertexProgram implements VertexProgram<TraverserSet<
         for (final String key : toProcessMemoryKeys) {
             final Step<Object, Object> step = this.traversalMatrix.getStepById(key);
             if (null == step) continue;
-            assert step instanceof Barrier || step instanceof LocalBarrier;
+            assert step instanceof Barrier;
             completedBarriers.add(step.getId());
-            if (step instanceof Barrier) {
+            if (!(step instanceof LocalBarrier)) {  // local barriers don't do any processing
on the master traversal (they just lock on the workers)
                 final Barrier<Object> barrier = (Barrier<Object>) step;
                 barrier.addBarrier(memory.get(key));
                 while (step.hasNext()) {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3da67b9b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
index ed0082c..d8b7479 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/TraverserExecutor.java
@@ -144,27 +144,32 @@ public final class TraverserExecutor {
         if (step instanceof Barrier) {
             if (step instanceof Bypassing)
                 ((Bypassing) step).setBypass(true);
-            final Barrier barrier = (Barrier) step;
-            while (barrier.hasNextBarrier()) {
-                memory.add(step.getId(), barrier.nextBarrier());
+            if (step instanceof LocalBarrier) {
+                final LocalBarrier<Object> barrier = (LocalBarrier<Object>) step;
+                final TraverserSet<Object> traverserSet = vertex.<TraverserSet<Object>>property(TraversalVertexProgram.ACTIVE_TRAVERSERS).orElse(new
TraverserSet<>());
+                vertex.property(TraversalVertexProgram.ACTIVE_TRAVERSERS, traverserSet);
+                while (barrier.hasNextBarrier()) {
+                    final TraverserSet<Object> barrierSet = barrier.nextBarrier();
+                    IteratorUtils.removeOnNext(barrierSet.iterator()).forEachRemaining(traverser
-> {
+                        if (traverser.asAdmin().isHalted()) {
+                            traverser.asAdmin().detach();
+                            haltedTraversers.add(traverser.asAdmin());
+                            if (returnHaltedTraversers)
+                                memory.add(TraversalVertexProgram.HALTED_TRAVERSERS, new
TraverserSet<>(traverser.asAdmin().split()));
+                        } else {
+                            traverser.asAdmin().detach();
+                            traverserSet.add(traverser.asAdmin());
+                        }
+                    });
+                }
                 memory.add(TraversalVertexProgram.MUTATED_MEMORY_KEYS, new HashSet<>(Collections.singleton(step.getId())));
-            }
-        } else if (step instanceof LocalBarrier) {
-            final TraverserSet<Object> traverserSet = vertex.<TraverserSet<Object>>property(TraversalVertexProgram.ACTIVE_TRAVERSERS).orElse(new
TraverserSet<>());
-            vertex.property(TraversalVertexProgram.ACTIVE_TRAVERSERS, traverserSet);
-            step.forEachRemaining(traverser -> {
-                if (traverser.asAdmin().isHalted()) {
-                    traverser.asAdmin().detach();
-                    haltedTraversers.add(traverser.asAdmin());
-                    if (returnHaltedTraversers)
-                        memory.add(TraversalVertexProgram.HALTED_TRAVERSERS, new TraverserSet<>(traverser.asAdmin().split()));
-                } else {
-                    traverser.asAdmin().detach();
-                    traverserSet.add(traverser.asAdmin());
+            } else {
+                final Barrier barrier = (Barrier) step;
+                while (barrier.hasNextBarrier()) {
+                    memory.add(step.getId(), barrier.nextBarrier());
                 }
-            });
-            memory.add(step.getId(), true);
-            memory.add(TraversalVertexProgram.MUTATED_MEMORY_KEYS, new HashSet<>(Collections.singleton(step.getId())));
+                memory.add(TraversalVertexProgram.MUTATED_MEMORY_KEYS, new HashSet<>(Collections.singleton(step.getId())));
+            }
         } else { // LOCAL PROCESSING
             step.forEachRemaining(traverser -> {
                 if (traverser.asAdmin().isHalted()) {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3da67b9b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
index 8393a8a..2ed3dd7 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
@@ -89,6 +89,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.map.MeanGlobalStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.MeanLocalStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.MinGlobalStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.MinLocalStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.NoOpBarrierStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderGlobalStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderLocalStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.PathStep;
@@ -1181,7 +1182,7 @@ public interface GraphTraversal<S, E> extends Traversal<S,
E> {
     }
 
     public default GraphTraversal<S, E> barrier(final int maxBarrierSize) {
-        return this.asAdmin().addStep(new LambdaCollectingBarrierStep<>(this.asAdmin(),
(Consumer) LambdaCollectingBarrierStep.Consumers.noOp, maxBarrierSize));
+        return this.asAdmin().addStep(new NoOpBarrierStep<>(this.asAdmin(), maxBarrierSize));
     }
 
     public default GraphTraversal<S, E> barrier(final Consumer<TraverserSet<Object>>
barrierConsumer) {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3da67b9b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/LocalBarrier.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/LocalBarrier.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/LocalBarrier.java
index b4959f1..899c43b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/LocalBarrier.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/LocalBarrier.java
@@ -19,8 +19,18 @@
 
 package org.apache.tinkerpop.gremlin.process.traversal.step;
 
+import org.apache.tinkerpop.gremlin.process.computer.MemoryComputeKey;
+import org.apache.tinkerpop.gremlin.process.traversal.Operator;
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
+
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
-public interface LocalBarrier extends MemoryComputing<Boolean>, GraphComputing {
+public interface LocalBarrier<S> extends Barrier<TraverserSet<S>> {
+
+    public default MemoryComputeKey getMemoryComputeKey() {
+        return MemoryComputeKey.of(((Step) this).getId(), Operator.and, false, true);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3da67b9b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LambdaCollectingBarrierStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LambdaCollectingBarrierStep.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LambdaCollectingBarrierStep.java
index dbad6a0..0019708 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LambdaCollectingBarrierStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/LambdaCollectingBarrierStep.java
@@ -32,6 +32,10 @@ import java.util.function.Consumer;
  */
 public final class LambdaCollectingBarrierStep<S> extends CollectingBarrierStep<S>
implements LambdaHolder {
 
+    /**
+     * @deprecated Since 3.2.0 -- use {@link NoOpBarrierStep}.
+     */
+    @Deprecated
     public enum Consumers implements Consumer<TraverserSet<Object>> {
         noOp {
             @Override

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3da67b9b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/NoOpBarrierStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/NoOpBarrierStep.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/NoOpBarrierStep.java
new file mode 100644
index 0000000..370e404
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/NoOpBarrierStep.java
@@ -0,0 +1,117 @@
+/*
+ * 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.tinkerpop.gremlin.process.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.LocalBarrier;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
+import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+
+import java.util.Collections;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class NoOpBarrierStep<S> extends AbstractStep<S, S> implements LocalBarrier<S>
{
+
+    private int maxBarrierSize;
+    private TraverserSet<S> barrier = new TraverserSet<>();
+
+    public NoOpBarrierStep(final Traversal.Admin traversal) {
+        this(traversal, Integer.MAX_VALUE);
+    }
+
+    public NoOpBarrierStep(final Traversal.Admin traversal, final int maxBarrierSize) {
+        super(traversal);
+        this.maxBarrierSize = maxBarrierSize;
+    }
+
+    @Override
+    protected Traverser<S> processNextStart() throws NoSuchElementException {
+        this.processAllStarts();
+        return this.barrier.remove();
+    }
+
+    @Override
+    public Set<TraverserRequirement> getRequirements() {
+        return Collections.singleton(TraverserRequirement.BULK);
+    }
+
+    @Override
+    public void processAllStarts() {
+        while (this.starts.hasNext() && (this.maxBarrierSize == Integer.MAX_VALUE
|| this.barrier.size() < this.maxBarrierSize)) {
+            final Traverser.Admin<S> traverser = this.starts.next();
+            traverser.setStepId(this.getNextStep().getId()); // when barrier is reloaded,
the traversers should be at the next step
+            this.barrier.add(traverser);
+        }
+    }
+
+    @Override
+    public boolean hasNextBarrier() {
+        this.processAllStarts();
+        return !this.barrier.isEmpty();
+    }
+
+    @Override
+    public TraverserSet<S> nextBarrier() throws NoSuchElementException {
+        this.processAllStarts();
+        if (this.barrier.isEmpty())
+            throw FastNoSuchElementException.instance();
+        else {
+            final TraverserSet<S> temp = this.barrier;
+            this.barrier = new TraverserSet<>();
+            return temp;
+        }
+    }
+
+    @Override
+    public void addBarrier(final TraverserSet<S> barrier) {
+        this.barrier.addAll(barrier);
+    }
+
+    @Override
+    public NoOpBarrierStep<S> clone() {
+        final NoOpBarrierStep<S> clone = (NoOpBarrierStep<S>) super.clone();
+        clone.barrier = new TraverserSet<>();
+        return clone;
+    }
+
+    @Override
+    public String toString() {
+        return StringFactory.stepString(this, this.maxBarrierSize == Integer.MAX_VALUE ?
null : this.maxBarrierSize);
+    }
+
+    @Override
+    public int hashCode() {
+        return super.hashCode() ^ this.maxBarrierSize;
+    }
+
+    @Override
+    public void reset() {
+        super.reset();
+        this.barrier.clear();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3da67b9b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AggregateStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AggregateStep.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AggregateStep.java
index 5116e9a..c397a7a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AggregateStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AggregateStep.java
@@ -18,7 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect;
 
-import org.apache.tinkerpop.gremlin.process.computer.MemoryComputeKey;
 import org.apache.tinkerpop.gremlin.process.traversal.Operator;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
@@ -26,9 +25,11 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.ByModulating;
 import org.apache.tinkerpop.gremlin.process.traversal.step.LocalBarrier;
 import org.apache.tinkerpop.gremlin.process.traversal.step.SideEffectCapable;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
+import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 import org.apache.tinkerpop.gremlin.util.function.BulkSetSupplier;
@@ -36,18 +37,18 @@ import org.apache.tinkerpop.gremlin.util.function.BulkSetSupplier;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.NoSuchElementException;
 import java.util.Set;
 import java.util.function.Supplier;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
-public final class AggregateStep<S> extends SideEffectStep<S> implements SideEffectCapable<Collection,
Collection>, TraversalParent, ByModulating, LocalBarrier {
+public final class AggregateStep<S> extends AbstractStep<S, S> implements SideEffectCapable<Collection,
Collection>, TraversalParent, ByModulating, LocalBarrier<S> {
 
     private Traversal.Admin<S, Object> aggregateTraversal = null;
     private String sideEffectKey;
-    private boolean onGraphComputer = false;
-    private final TraverserSet<S> barrier = new TraverserSet<>();
+    private TraverserSet<S> barrier = new TraverserSet<>();
 
     public AggregateStep(final Traversal.Admin traversal, final String sideEffectKey) {
         super(traversal);
@@ -83,6 +84,7 @@ public final class AggregateStep<S> extends SideEffectStep<S>
implements SideEff
     @Override
     public AggregateStep<S> clone() {
         final AggregateStep<S> clone = (AggregateStep<S>) super.clone();
+        clone.barrier = new TraverserSet<>();
         if (null != this.aggregateTraversal)
             clone.aggregateTraversal = this.aggregateTraversal.clone();
         return clone;
@@ -103,33 +105,51 @@ public final class AggregateStep<S> extends SideEffectStep<S>
implements SideEff
     }
 
     @Override
-    protected void sideEffect(final Traverser.Admin<S> traverser) {
-        final BulkSet<Object> bulkSet = new BulkSet<>();
-        bulkSet.add(TraversalUtil.applyNullable(traverser, this.aggregateTraversal), traverser.bulk());
-        this.getTraversal().getSideEffects().add(this.sideEffectKey, bulkSet);
+    protected Traverser<S> processNextStart() {
+        this.processAllStarts();
+        return this.barrier.remove();
     }
 
     @Override
-    protected Traverser<S> processNextStart() {
-        if (this.onGraphComputer)
-            return super.processNextStart();
-        else {
+    public void processAllStarts() {
+        if (this.starts.hasNext()) {
+            final BulkSet<Object> bulkSet = new BulkSet<>();
             while (this.starts.hasNext()) {
                 final Traverser.Admin<S> traverser = this.starts.next();
-                this.sideEffect(traverser);
+                bulkSet.add(TraversalUtil.applyNullable(traverser, this.aggregateTraversal),
traverser.bulk());
+                traverser.setStepId(this.getNextStep().getId()); // when barrier is reloaded,
the traversers should be at the next step
                 this.barrier.add(traverser);
             }
-            return this.barrier.remove();
+            this.getTraversal().getSideEffects().add(this.sideEffectKey, bulkSet);
+        }
+    }
+
+    @Override
+    public boolean hasNextBarrier() {
+        this.processAllStarts();
+        return !this.barrier.isEmpty();
+    }
+
+    @Override
+    public TraverserSet<S> nextBarrier() throws NoSuchElementException {
+        this.processAllStarts();
+        if (this.barrier.isEmpty())
+            throw FastNoSuchElementException.instance();
+        else {
+            final TraverserSet<S> temp = this.barrier;
+            this.barrier = new TraverserSet<>();
+            return temp;
         }
     }
 
     @Override
-    public MemoryComputeKey<Boolean> getMemoryComputeKey() {
-        return MemoryComputeKey.of(this.getId(), Operator.and, false, true);
+    public void addBarrier(final TraverserSet<S> barrier) {
+        this.barrier.addAll(barrier);
     }
 
     @Override
-    public void onGraphComputer() {
-        this.onGraphComputer = true;
+    public void reset() {
+        super.reset();
+        this.barrier.clear();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3da67b9b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java
index 4a9ed8a..9bc3cdf 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/LazyBarrierStrategy.java
@@ -21,22 +21,19 @@ package org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Barrier;
 import org.apache.tinkerpop.gremlin.process.traversal.step.HasContainerHolder;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.FilterStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.EdgeVertexStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.LambdaCollectingBarrierStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.NoOpBarrierStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.CollectingBarrierStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.ReducingBarrierStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.SupplyingBarrierStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
 
 import java.util.HashSet;
 import java.util.Set;
-import java.util.function.Consumer;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -81,12 +78,8 @@ public final class LazyBarrierStrategy extends AbstractTraversalStrategy<Travers
                 if (i == 0)
                     bigStart = step instanceof GraphStep && (((GraphStep) step).getIds().length
>= BIG_START_SIZE || (((GraphStep) step).getIds().length == 0 && step instanceof
HasContainerHolder && ((HasContainerHolder) step).getHasContainers().isEmpty()));
                 else if ('v' == foundVertexStep || bigStart) {
-                    if (!(step instanceof FilterStep) &&
-                            !(step instanceof CollectingBarrierStep) &&
-                            !(step instanceof SupplyingBarrierStep) &&
-                            !(step instanceof ReducingBarrierStep) &&
-                            !(step instanceof VertexStep && ((VertexStep) step).returnsEdge()))
{
-                        TraversalHelper.insertAfterStep(new LambdaCollectingBarrierStep<>(traversal,
(Consumer) LambdaCollectingBarrierStep.Consumers.noOp, MAX_BARRIER_SIZE), step, traversal);
+                    if (!(step instanceof FilterStep) && !(step instanceof Barrier)
&& !(step instanceof VertexStep && ((VertexStep) step).returnsEdge())) {
+                        TraversalHelper.insertAfterStep(new NoOpBarrierStep<>(traversal,
MAX_BARRIER_SIZE), step, traversal);
                     }
                 }
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3da67b9b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MatchStepTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MatchStepTest.java
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MatchStepTest.java
index 7360e24..37e70bf 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MatchStepTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MatchStepTest.java
@@ -41,8 +41,16 @@ import java.util.List;
 import java.util.function.Consumer;
 
 import static org.apache.tinkerpop.gremlin.process.traversal.P.eq;
-import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.*;
-import static org.junit.Assert.*;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.and;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.as;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.in;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.match;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.or;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.out;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.where;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -126,7 +134,7 @@ public class MatchStepTest extends StepTest {
             assertEquals(PathStep.class, ((MatchStep<?, ?>) pattern.getStartStep()).getGlobalChildren().get(0).getStartStep().getNextStep().getClass());
             assertEquals("d", ((MatchStep.MatchEndStep) ((MatchStep<?, ?>) pattern.getStartStep()).getGlobalChildren().get(0).getEndStep()).getMatchKey().get());
             assertEquals("e", ((MatchStep.MatchStartStep) ((MatchStep<?, ?>) pattern.getStartStep()).getGlobalChildren().get(1).getStartStep()).getSelectKey().get());
-            assertEquals(LambdaCollectingBarrierStep.class, ((MatchStep<?, ?>) pattern.getStartStep()).getGlobalChildren().get(1).getStartStep().getNextStep().getClass());
+            assertEquals(NoOpBarrierStep.class, ((MatchStep<?, ?>) pattern.getStartStep()).getGlobalChildren().get(1).getStartStep().getNextStep().getClass());
             assertFalse(((MatchStep.MatchEndStep) ((MatchStep<?, ?>) pattern.getStartStep()).getGlobalChildren().get(1).getEndStep()).getMatchKey().isPresent());
         });
     }


Mime
View raw message