Skip to content

Commit

Permalink
Make IndexCursorProgressor AutoClosable and remove Lazy class
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd committed Nov 9, 2017
1 parent 66c31e4 commit 812d133
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 69 deletions.
Expand Up @@ -54,9 +54,9 @@ public static <T> Supplier<T> singleton( final T instance )
* @param <T> The object type
* @return A {@link Supplier} returning the specified object instance
*/
public static <T> Supplier<T> lazySingleton( final Supplier<T> supplier )
public static <T> Lazy<T> lazySingleton( final Supplier<T> supplier )
{
return new Supplier<T>()
return new Lazy<T>()
{
volatile T instance;

Expand Down Expand Up @@ -165,4 +165,8 @@ public String toString()
return String.format( "%s on %s", predicate, input );
}
}

public interface Lazy<T> extends Supplier<T>
{
};
}
Expand Up @@ -22,7 +22,7 @@
import org.neo4j.internal.kernel.api.LabelSet;
import org.neo4j.values.storable.Value;

public interface IndexCursorProgressor
public interface IndexCursorProgressor extends AutoCloseable
{
boolean next();

Expand Down

This file was deleted.

Expand Up @@ -23,6 +23,8 @@
import java.nio.ByteOrder;
import java.util.function.Supplier;

import org.neo4j.function.Suppliers;
import org.neo4j.function.Suppliers.Lazy;
import org.neo4j.internal.kernel.api.Token;
import org.neo4j.io.pagecache.PageCursor;
import org.neo4j.kernel.api.ExplicitIndex;
Expand Down Expand Up @@ -80,7 +82,7 @@ class Store extends Read implements Token
this.relationshipStore = stores.getRelationshipStore();
this.groupStore = stores.getRelationshipGroupStore();
this.propertyStore = stores.getPropertyStore();
this.explicitIndexes = new Lazy<>( explicitIndexes );
this.explicitIndexes = Suppliers.lazySingleton( explicitIndexes );
}

@Override
Expand Down

0 comments on commit 812d133

Please sign in to comment.