use of org.neo4j.fabric.FabricDatabaseManager in project neo4j by neo4j.
the class FabricServicesBootstrap method bootstrapServices.
public void bootstrapServices() {
LogProvider internalLogProvider = logService.getInternalLogProvider();
@SuppressWarnings("unchecked") var databaseManager = (DatabaseManager<DatabaseContext>) resolve(DatabaseManager.class);
var fabricDatabaseManager = register(createFabricDatabaseManager(fabricConfig), FabricDatabaseManager.class);
var jobScheduler = resolve(JobScheduler.class);
var monitors = resolve(Monitors.class);
var databaseAccess = createFabricDatabaseAccess();
var remoteExecutor = bootstrapRemoteStack();
var localExecutor = register(new FabricLocalExecutor(fabricConfig, fabricDatabaseManager, databaseAccess), FabricLocalExecutor.class);
var systemNanoClock = resolve(SystemNanoClock.class);
var transactionMonitor = register(new FabricTransactionMonitor(systemNanoClock, logService, fabricConfig), FabricTransactionMonitor.class);
var transactionCheckInterval = config.get(GraphDatabaseSettings.transaction_monitor_check_interval).toMillis();
register(new TransactionMonitorScheduler(transactionMonitor, jobScheduler, transactionCheckInterval, null), TransactionMonitorScheduler.class);
var errorReporter = new ErrorReporter(logService);
register(new TransactionManager(remoteExecutor, localExecutor, errorReporter, fabricConfig, transactionMonitor, securityLog, systemNanoClock, config, availabilityGuard), TransactionManager.class);
var cypherConfig = CypherConfiguration.fromConfig(config);
Supplier<GlobalProcedures> proceduresSupplier = () -> resolve(GlobalProcedures.class);
var catalogManager = register(createCatalogManger(), CatalogManager.class);
var signatureResolver = new SignatureResolver(proceduresSupplier);
var statementLifecycles = new FabricStatementLifecycles(databaseManager, monitors, config, systemNanoClock);
var monitoredExecutor = jobScheduler.monitoredJobExecutor(CYPHER_CACHE);
var cacheFactory = new ExecutorBasedCaffeineCacheFactory(job -> monitoredExecutor.execute(systemJob("Query plan cache maintenance"), job));
var planner = register(new FabricPlanner(fabricConfig, cypherConfig, monitors, cacheFactory, signatureResolver), FabricPlanner.class);
var useEvaluation = register(new UseEvaluation(catalogManager, proceduresSupplier, signatureResolver), UseEvaluation.class);
register(new FabricReactorHooksService(errorReporter), FabricReactorHooksService.class);
Executor fabricWorkerExecutor = jobScheduler.executor(FABRIC_WORKER);
var fabricExecutor = new FabricExecutor(fabricConfig, planner, useEvaluation, catalogManager, internalLogProvider, statementLifecycles, fabricWorkerExecutor);
register(fabricExecutor, FabricExecutor.class);
register(new TransactionBookmarkManagerFactory(fabricDatabaseManager), TransactionBookmarkManagerFactory.class);
}
use of org.neo4j.fabric.FabricDatabaseManager in project neo4j by neo4j.
the class FabricServicesBootstrap method createBoltDatabaseManagementServiceProvider.
public BoltGraphDatabaseManagementServiceSPI createBoltDatabaseManagementServiceProvider(BoltGraphDatabaseManagementServiceSPI kernelDatabaseManagementService, DatabaseManagementService managementService, Monitors monitors, SystemNanoClock clock) {
FabricExecutor fabricExecutor = dependencies.resolveDependency(FabricExecutor.class);
TransactionManager transactionManager = dependencies.resolveDependency(TransactionManager.class);
FabricDatabaseManager fabricDatabaseManager = dependencies.resolveDependency(FabricDatabaseManager.class);
var serverConfig = dependencies.resolveDependency(Config.class);
var transactionIdTracker = new TransactionIdTracker(managementService, monitors, clock);
var databaseManager = (DatabaseManager<DatabaseContext>) dependencies.resolveDependency(DatabaseManager.class);
var databaseIdRepository = databaseManager.databaseIdRepository();
var transactionBookmarkManagerFactory = dependencies.resolveDependency(TransactionBookmarkManagerFactory.class);
var localGraphTransactionIdTracker = new LocalGraphTransactionIdTracker(transactionIdTracker, databaseIdRepository, serverConfig);
var fabricDatabaseManagementService = dependencies.satisfyDependency(new BoltFabricDatabaseManagementService(fabricExecutor, fabricConfig, transactionManager, fabricDatabaseManager, localGraphTransactionIdTracker, transactionBookmarkManagerFactory));
return new BoltGraphDatabaseManagementServiceSPI() {
@Override
public BoltGraphDatabaseServiceSPI database(String databaseName, MemoryTracker memoryTracker) throws UnavailableException, DatabaseNotFoundException {
if (fabricDatabaseManager.hasMultiGraphCapabilities(databaseName)) {
return fabricDatabaseManagementService.database(databaseName, memoryTracker);
}
return kernelDatabaseManagementService.database(databaseName, memoryTracker);
}
@Override
public Optional<CustomBookmarkFormatParser> getCustomBookmarkFormatParser() {
return fabricDatabaseManagementService.getCustomBookmarkFormatParser();
}
};
}
Aggregations