Commit f368e0c2 authored by Mattias Persson's avatar Mattias Persson
Browse files

Merge branch '2.3' into 3.0

parents 27061e4b 64422091
No related merge requests found
Showing with 13 additions and 16 deletions
+13 -16
......@@ -126,8 +126,8 @@ class CountsBuilderDecorator extends CheckDecorator.Adapter
{
this.storeAccess = storeAccess;
this.nodeStore = storeAccess.getRawNeoStores().getNodeStore();
this.nodeCountBuildCondition = new MultiPassAvoidanceCondition<>();
this.relationshipCountBuildCondition = new MultiPassAvoidanceCondition<>();
this.nodeCountBuildCondition = new MultiPassAvoidanceCondition<>( 0 );
this.relationshipCountBuildCondition = new MultiPassAvoidanceCondition<>( 1 );
}
@Override
......@@ -333,28 +333,25 @@ class CountsBuilderDecorator extends CheckDecorator.Adapter
private static class MultiPassAvoidanceCondition<T extends AbstractBaseRecord> implements Predicate<T>
{
private boolean used;
private boolean done;
// Stage which this condition is active, starting from 0, mimicing the CheckStage ordinal
private final int activeStage;
// The same thread updates this every time, the TaskExecutor. Other threads read it
private volatile int stage = -1;
public MultiPassAvoidanceCondition( int activeStage )
{
this.activeStage = activeStage;
}
public void prepare()
{
if ( used )
{
done = true;
}
stage++;
}
@Override
public boolean test( T record )
{
try
{
return !done;
}
finally
{
used = true;
}
return stage == activeStage;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment