Search in sources :

Example 1 with UnsatisfiedDependencyException

use of org.neo4j.exceptions.UnsatisfiedDependencyException in project neo4j by neo4j.

the class AbstractExtensions method init.

@Override
public void init() {
    for (ExtensionFactory<?> extensionFactory : extensionFactories) {
        try {
            Object extensionDependencies = getExtensionDependencies(extensionFactory);
            Lifecycle dependency = newInstance(extensionContext, extensionFactory, extensionDependencies);
            Objects.requireNonNull(dependency, extensionFactory + " returned a null extension.");
            life.add(dependencies.satisfyDependency(dependency));
        } catch (UnsatisfiedDependencyException exception) {
            extensionFailureStrategy.handle(extensionFactory, exception);
        } catch (Throwable throwable) {
            extensionFailureStrategy.handle(extensionFactory, throwable);
        }
    }
    life.init();
}
Also used : UnsatisfiedDependencyException(org.neo4j.exceptions.UnsatisfiedDependencyException) Lifecycle(org.neo4j.kernel.lifecycle.Lifecycle)

Example 2 with UnsatisfiedDependencyException

use of org.neo4j.exceptions.UnsatisfiedDependencyException in project neo4j by neo4j.

the class LogFilesBuilder method buildContext.

TransactionLogFilesContext buildContext() throws IOException {
    if (logEntryReader == null) {
        requireNonNull(commandReaderFactory);
        logEntryReader = new VersionAwareLogEntryReader(commandReaderFactory);
    }
    if (config == null) {
        config = Config.defaults();
    }
    requireNonNull(fileSystem);
    Supplier<StoreId> storeIdSupplier = getStoreId();
    Supplier<LogVersionRepository> logVersionRepositorySupplier = getLogVersionRepositorySupplier();
    LongSupplier lastCommittedIdSupplier = lastCommittedIdSupplier();
    LongSupplier committingTransactionIdSupplier = committingIdSupplier();
    Supplier<LogPosition> lastClosedTransactionPositionSupplier = closePositionSupplier();
    // Register listener for rotation threshold
    AtomicLong rotationThreshold = getRotationThresholdAndRegisterForUpdates();
    AtomicBoolean tryPreallocateTransactionLogs = getTryToPreallocateTransactionLogs();
    var nativeAccess = getNativeAccess();
    var monitors = getMonitors();
    var health = getDatabaseHealth();
    var clock = getClock();
    // Or the latest version if we can't find the system db version.
    if (kernelVersionRepository == null) {
        kernelVersionRepository = () -> KernelVersion.LATEST;
        if (dependencies != null) {
            try {
                this.kernelVersionRepository = dependencies.resolveDependency(KernelVersionRepository.class);
            } catch (UnsatisfiedDependencyException e) {
            // Use latest version if can't find version repository.
            }
        }
    }
    return new TransactionLogFilesContext(rotationThreshold, tryPreallocateTransactionLogs, logEntryReader, lastCommittedIdSupplier, committingTransactionIdSupplier, lastClosedTransactionPositionSupplier, logVersionRepositorySupplier, fileSystem, logProvider, databaseTracers, storeIdSupplier, nativeAccess, memoryTracker, monitors, config.get(fail_on_corrupted_log_files), health, kernelVersionRepository, clock, config);
}
Also used : LogVersionRepository(org.neo4j.storageengine.api.LogVersionRepository) KernelVersionRepository(org.neo4j.storageengine.api.KernelVersionRepository) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AtomicLong(java.util.concurrent.atomic.AtomicLong) UnsatisfiedDependencyException(org.neo4j.exceptions.UnsatisfiedDependencyException) StoreId(org.neo4j.storageengine.api.StoreId) VersionAwareLogEntryReader(org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader) LongSupplier(java.util.function.LongSupplier) LogPosition(org.neo4j.kernel.impl.transaction.log.LogPosition)

Aggregations

UnsatisfiedDependencyException (org.neo4j.exceptions.UnsatisfiedDependencyException)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 LongSupplier (java.util.function.LongSupplier)1 LogPosition (org.neo4j.kernel.impl.transaction.log.LogPosition)1 VersionAwareLogEntryReader (org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader)1 Lifecycle (org.neo4j.kernel.lifecycle.Lifecycle)1 KernelVersionRepository (org.neo4j.storageengine.api.KernelVersionRepository)1 LogVersionRepository (org.neo4j.storageengine.api.LogVersionRepository)1 StoreId (org.neo4j.storageengine.api.StoreId)1