Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loaded using service loading. Since importer logic moved into ImportLogic and ParallelBatchImporter is a thin layer using it, this service loading enables other implementations using that same base
- Loading branch information
Showing
7 changed files
with
122 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
community/kernel/src/main/java/org/neo4j/unsafe/impl/batchimport/BatchImporterFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,64 @@ | |||
/* | |||
* Copyright (c) 2002-2018 "Neo Technology," | |||
* Network Engine for Objects in Lund AB [http://neotechnology.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 <http://www.gnu.org/licenses/>. | |||
*/ | |||
package org.neo4j.unsafe.impl.batchimport; | |||
|
|||
import java.io.File; | |||
import java.util.NoSuchElementException; | |||
|
|||
import org.neo4j.helpers.Service; | |||
import org.neo4j.io.fs.FileSystemAbstraction; | |||
import org.neo4j.io.pagecache.PageCache; | |||
import org.neo4j.kernel.configuration.Config; | |||
import org.neo4j.kernel.impl.logging.LogService; | |||
import org.neo4j.kernel.impl.store.format.RecordFormats; | |||
import org.neo4j.unsafe.impl.batchimport.staging.ExecutionMonitor; | |||
|
|||
public abstract class BatchImporterFactory extends Service | |||
{ | |||
private final int priority; | |||
|
|||
protected BatchImporterFactory( String key, int priority ) | |||
{ | |||
super( key ); | |||
this.priority = priority; | |||
} | |||
|
|||
public abstract BatchImporter instantiate( File storeDir, FileSystemAbstraction fileSystem, PageCache externalPageCache, | |||
Configuration config, LogService logService, ExecutionMonitor executionMonitor, | |||
AdditionalInitialIds additionalInitialIds, Config dbConfig, RecordFormats recordFormats, ImportLogic.Monitor monitor ); | |||
|
|||
public static BatchImporterFactory withHighestPriority() | |||
{ | |||
Iterable<BatchImporterFactory> candidates = Service.load( BatchImporterFactory.class ); | |||
BatchImporterFactory highestPrioritized = null; | |||
for ( BatchImporterFactory candidate : candidates ) | |||
{ | |||
if ( highestPrioritized == null || candidate.priority > highestPrioritized.priority ) | |||
{ | |||
highestPrioritized = candidate; | |||
} | |||
} | |||
if ( highestPrioritized == null ) | |||
{ | |||
throw new NoSuchElementException( "No batch importers found" ); | |||
} | |||
return highestPrioritized; | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
.../kernel/src/main/java/org/neo4j/unsafe/impl/batchimport/StandardBatchImporterFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,48 @@ | |||
/* | |||
* Copyright (c) 2002-2018 "Neo Technology," | |||
* Network Engine for Objects in Lund AB [http://neotechnology.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 <http://www.gnu.org/licenses/>. | |||
*/ | |||
package org.neo4j.unsafe.impl.batchimport; | |||
|
|||
import java.io.File; | |||
|
|||
import org.neo4j.io.fs.FileSystemAbstraction; | |||
import org.neo4j.io.pagecache.PageCache; | |||
import org.neo4j.kernel.configuration.Config; | |||
import org.neo4j.kernel.impl.logging.LogService; | |||
import org.neo4j.kernel.impl.store.format.RecordFormats; | |||
import org.neo4j.unsafe.impl.batchimport.staging.ExecutionMonitor; | |||
|
|||
public class StandardBatchImporterFactory extends BatchImporterFactory | |||
{ | |||
public static final String NAME = "standard"; | |||
|
|||
public StandardBatchImporterFactory() | |||
{ | |||
super( NAME, 1 ); | |||
} | |||
|
|||
@Override | |||
public BatchImporter instantiate( File storeDir, FileSystemAbstraction fileSystem, PageCache externalPageCache, Configuration config, | |||
LogService logService, ExecutionMonitor executionMonitor, AdditionalInitialIds additionalInitialIds, Config dbConfig, | |||
RecordFormats recordFormats, ImportLogic.Monitor monitor ) | |||
{ | |||
return new ParallelBatchImporter( storeDir, fileSystem, externalPageCache, config, logService, executionMonitor, | |||
additionalInitialIds, dbConfig, recordFormats, monitor ); | |||
} | |||
} |
1 change: 1 addition & 0 deletions
1
...c/main/resources/META-INF/services/org.neo4j.unsafe.impl.batchimport.BatchImporterFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
org.neo4j.unsafe.impl.batchimport.StandardBatchImporterFactory |