use of org.neo4j.kernel.impl.query.QueryExecutionEngine in project neo4j by neo4j.
the class BoltFactoryImpl method start.
@Override
public void start() throws Throwable {
DependencyResolver dependencyResolver = gds.getDependencyResolver();
queryExecutionEngine = dependencyResolver.resolveDependency(QueryExecutionEngine.class);
queryService = dependencyResolver.resolveDependency(GraphDatabaseQueryService.class);
transactionIdStore = dependencyResolver.resolveDependency(TransactionIdStore.class);
availabilityGuard = dependencyResolver.resolveDependency(AvailabilityGuard.class);
}
use of org.neo4j.kernel.impl.query.QueryExecutionEngine in project neo4j by neo4j.
the class ServerExecutionEngineTest method shouldNotDetectInvalidQueriesAsPeriodicCommitQueries.
@Test
public void shouldNotDetectInvalidQueriesAsPeriodicCommitQueries() throws Exception {
// GIVEN
QueryExecutionEngine engine = rule.getGraphDatabaseAPI().getDependencyResolver().resolveDependency(QueryExecutionEngine.class);
// WHEN
boolean result = engine.isPeriodicCommit("MATCH n RETURN m");
// THEN
assertFalse("Did detect an invalid query as periodic commit query", result);
}
use of org.neo4j.kernel.impl.query.QueryExecutionEngine in project neo4j by neo4j.
the class CommunityCypherEngineProvider method createEngine.
@Override
protected QueryExecutionEngine createEngine(Dependencies deps, GraphDatabaseAPI graphAPI) {
GraphDatabaseCypherService queryService = new GraphDatabaseCypherService(graphAPI);
deps.satisfyDependency(queryService);
DependencyResolver resolver = graphAPI.getDependencyResolver();
LogService logService = resolver.resolveDependency(LogService.class);
KernelAPI kernelAPI = resolver.resolveDependency(KernelAPI.class);
Monitors monitors = resolver.resolveDependency(Monitors.class);
LogProvider logProvider = logService.getInternalLogProvider();
CommunityCompatibilityFactory compatibilityFactory = new CommunityCompatibilityFactory(queryService, kernelAPI, monitors, logProvider);
deps.satisfyDependencies(compatibilityFactory);
return new ExecutionEngine(queryService, logProvider, compatibilityFactory);
}
use of org.neo4j.kernel.impl.query.QueryExecutionEngine in project neo4j by neo4j.
the class GraphDatabaseFacadeFactory method initFacade.
/**
* Instantiate a graph database given configuration, dependencies, and a custom implementation of {@link org
* .neo4j.kernel.impl.factory.GraphDatabaseFacade}.
*
* @param storeDir the directory where the Neo4j data store is located
* @param config configuration
* @param dependencies the dependencies required to construct the {@link GraphDatabaseFacade}
* @param graphDatabaseFacade the already created facade which needs initialisation
* @return the initialised {@link GraphDatabaseFacade}
*/
public GraphDatabaseFacade initFacade(File storeDir, Config config, final Dependencies dependencies, final GraphDatabaseFacade graphDatabaseFacade) {
PlatformModule platform = createPlatform(storeDir, config, dependencies, graphDatabaseFacade);
EditionModule edition = editionFactory.apply(platform);
AtomicReference<QueryExecutionEngine> queryEngine = new AtomicReference<>(noEngine());
final DataSourceModule dataSource = createDataSource(platform, edition, queryEngine::get);
Logger msgLog = platform.logging.getInternalLog(getClass()).infoLogger();
CoreAPIAvailabilityGuard coreAPIAvailabilityGuard = edition.coreAPIAvailabilityGuard;
ClassicCoreSPI spi = new ClassicCoreSPI(platform, dataSource, msgLog, coreAPIAvailabilityGuard);
graphDatabaseFacade.init(spi, dataSource.guard, dataSource.threadToTransactionBridge, platform.config);
// Start it
platform.dataSourceManager.addListener(new DataSourceManager.Listener() {
private QueryExecutionEngine engine;
@Override
public void registered(NeoStoreDataSource dataSource) {
if (engine == null) {
engine = QueryEngineProvider.initialize(platform.dependencies, platform.graphDatabaseFacade, dependencies.executionEngines());
}
queryEngine.set(engine);
}
@Override
public void unregistered(NeoStoreDataSource dataSource) {
queryEngine.set(noEngine());
}
});
Throwable error = null;
try {
// Done after create to avoid a redundant
// "database is now unavailable"
enableAvailabilityLogging(platform.availabilityGuard, msgLog);
platform.life.start();
} catch (final Throwable throwable) {
error = new RuntimeException("Error starting " + getClass().getName() + ", " + platform.storeDir, throwable);
} finally {
if (error != null) {
try {
graphDatabaseFacade.shutdown();
} catch (Throwable shutdownError) {
error = Exceptions.withSuppressed(shutdownError, error);
}
}
}
if (error != null) {
msgLog.log("Failed to start database", error);
throw Exceptions.launderedException(error);
}
return graphDatabaseFacade;
}
use of org.neo4j.kernel.impl.query.QueryExecutionEngine in project neo4j by neo4j.
the class ServerExecutionEngineTest method shouldNotDetectNonPeriodicCommitQueriesAsPeriodicCommitQueries.
@Test
public void shouldNotDetectNonPeriodicCommitQueriesAsPeriodicCommitQueries() throws Exception {
// GIVEN
QueryExecutionEngine engine = rule.getGraphDatabaseAPI().getDependencyResolver().resolveDependency(QueryExecutionEngine.class);
// WHEN
boolean result = engine.isPeriodicCommit("CREATE ()");
// THEN
assertFalse("Did detect non-periodic commit query as periodic commit query", result);
}
Aggregations