Search in sources :

Example 1 with LockerLifecycleAdapter

use of org.neo4j.kernel.internal.locker.LockerLifecycleAdapter in project neo4j by neo4j.

the class Database method init.

/**
 * Initialize the database, and bring it to a state where its version can be examined, and it can be
 * upgraded if necessary.
 */
@Override
public synchronized void init() {
    if (initialized) {
        return;
    }
    try {
        databaseDependencies = new Dependencies(globalDependencies);
        ioController = ioControllerService.createIOController(databaseConfig, clock);
        databasePageCache = new DatabasePageCache(globalPageCache, ioController);
        databaseMonitors = new Monitors(parentMonitors, internalLogProvider);
        life = new LifeSupport();
        life.add(new LockerLifecycleAdapter(fileLockerService.createDatabaseLocker(fs, databaseLayout)));
        life.add(databaseConfig);
        databaseHealth = databaseHealthFactory.newInstance();
        databaseAvailability = new DatabaseAvailability(databaseAvailabilityGuard, transactionStats, clock, getAwaitActiveTransactionDeadlineMillis());
        databaseDependencies.satisfyDependency(this);
        databaseDependencies.satisfyDependency(ioController);
        databaseDependencies.satisfyDependency(readOnlyDatabaseChecker);
        databaseDependencies.satisfyDependency(databaseLayout);
        databaseDependencies.satisfyDependency(startupController);
        databaseDependencies.satisfyDependency(databaseConfig);
        databaseDependencies.satisfyDependency(databaseMonitors);
        databaseDependencies.satisfyDependency(databaseLogService);
        databaseDependencies.satisfyDependency(databasePageCache);
        databaseDependencies.satisfyDependency(tokenHolders);
        databaseDependencies.satisfyDependency(databaseFacade);
        databaseDependencies.satisfyDependency(kernelTransactionFactory);
        databaseDependencies.satisfyDependency(databaseHealth);
        databaseDependencies.satisfyDependency(storeCopyCheckPointMutex);
        databaseDependencies.satisfyDependency(transactionStats);
        databaseDependencies.satisfyDependency(locks);
        databaseDependencies.satisfyDependency(databaseAvailabilityGuard);
        databaseDependencies.satisfyDependency(databaseAvailability);
        databaseDependencies.satisfyDependency(idGeneratorFactory);
        databaseDependencies.satisfyDependency(idController);
        databaseDependencies.satisfyDependency(lockService);
        databaseDependencies.satisfyDependency(versionContextSupplier);
        databaseDependencies.satisfyDependency(tracers.getDatabaseTracer());
        databaseDependencies.satisfyDependency(tracers.getPageCacheTracer());
        databaseDependencies.satisfyDependency(storageEngineFactory);
        recoveryCleanupWorkCollector = RecoveryCleanupWorkCollector.immediate();
        databaseDependencies.satisfyDependency(recoveryCleanupWorkCollector);
        life.add(new PageCacheLifecycle(databasePageCache));
        life.add(initializeExtensions(databaseDependencies));
        DatabaseLayoutWatcher watcherService = watcherServiceFactory.apply(databaseLayout);
        life.add(watcherService);
        databaseDependencies.satisfyDependency(watcherService);
        otherDatabasePool = otherMemoryPool.newDatabasePool(namedDatabaseId.name(), 0, null);
        life.add(onShutdown(() -> otherDatabasePool.close()));
        otherDatabaseMemoryTracker = otherDatabasePool.getPoolMemoryTracker();
        databaseDependencies.satisfyDependency(new DatabaseMemoryTrackers(otherDatabaseMemoryTracker));
        eventListeners.databaseCreate(namedDatabaseId);
        initialized = true;
    } catch (Throwable e) {
        handleStartupFailure(e);
    }
}
Also used : DatabaseLayoutWatcher(org.neo4j.io.fs.watcher.DatabaseLayoutWatcher) LockerLifecycleAdapter(org.neo4j.kernel.internal.locker.LockerLifecycleAdapter) Monitors(org.neo4j.monitoring.Monitors) LifeSupport(org.neo4j.kernel.lifecycle.LifeSupport) DatabaseAvailability(org.neo4j.kernel.availability.DatabaseAvailability) Dependencies(org.neo4j.collection.Dependencies) DatabasePageCache(org.neo4j.dbms.database.DatabasePageCache) PageCacheLifecycle(org.neo4j.kernel.impl.pagecache.PageCacheLifecycle)

Aggregations

Dependencies (org.neo4j.collection.Dependencies)1 DatabasePageCache (org.neo4j.dbms.database.DatabasePageCache)1 DatabaseLayoutWatcher (org.neo4j.io.fs.watcher.DatabaseLayoutWatcher)1 DatabaseAvailability (org.neo4j.kernel.availability.DatabaseAvailability)1 PageCacheLifecycle (org.neo4j.kernel.impl.pagecache.PageCacheLifecycle)1 LockerLifecycleAdapter (org.neo4j.kernel.internal.locker.LockerLifecycleAdapter)1 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)1 Monitors (org.neo4j.monitoring.Monitors)1