diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/NativeIndexPopulatorPartSupplier.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/NativeIndexPopulatorPartSupplier.java new file mode 100644 index 0000000000000..3b231b8bbebc4 --- /dev/null +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/NativeIndexPopulatorPartSupplier.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2002-2018 "Neo4j," + * Neo4j Sweden AB [http://neo4j.com] + * + * This file is part of Neo4j. + * + * Neo4j is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.neo4j.kernel.impl.index.schema; + +import java.io.File; + +@FunctionalInterface +interface NativeIndexPopulatorPartSupplier,VALUE extends NativeIndexValue> +{ + NativeIndexPopulator part( File partFileName ); +} diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/ParallelNativeIndexPopulator.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/ParallelNativeIndexPopulator.java index 8dde39dc3319f..6154080fc9edb 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/ParallelNativeIndexPopulator.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/ParallelNativeIndexPopulator.java @@ -28,7 +28,6 @@ import java.util.Queue; import java.util.concurrent.ConcurrentLinkedDeque; import java.util.concurrent.CopyOnWriteArrayList; -import java.util.function.Function; import org.neo4j.cursor.RawCursor; import org.neo4j.index.internal.gbptree.Hit; @@ -68,7 +67,7 @@ class ParallelNativeIndexPopulator,VALUE extends // from being created beyond that point. private volatile boolean closed; - ParallelNativeIndexPopulator( File baseIndexFile, IndexLayout layout, Function> populatorSupplier ) + ParallelNativeIndexPopulator( File baseIndexFile, IndexLayout layout, NativeIndexPopulatorPartSupplier partSupplier ) { this.layout = layout; this.threadLocalPopulators = new ThreadLocal() @@ -86,14 +85,14 @@ protected synchronized ThreadLocalPopulator initialValue() } File file = new File( baseIndexFile + "-part-" + partPopulators.size() ); - NativeIndexPopulator populator = populatorSupplier.apply( file ); + NativeIndexPopulator populator = partSupplier.part( file ); ThreadLocalPopulator tlPopulator = new ThreadLocalPopulator( populator ); partPopulators.add( tlPopulator ); populator.create(); return tlPopulator; } }; - this.completePopulator = populatorSupplier.apply( baseIndexFile ); + this.completePopulator = partSupplier.part( baseIndexFile ); } @Override