Search in sources :

Example 1 with SimpleStatementLocksFactory

use of org.neo4j.kernel.impl.locking.SimpleStatementLocksFactory in project neo4j by neo4j.

the class StatementLocksFactorySelector method select.

public StatementLocksFactory select() {
    StatementLocksFactory statementLocksFactory;
    String serviceName = StatementLocksFactory.class.getSimpleName();
    List<StatementLocksFactory> factories = serviceLoadFactories();
    if (factories.isEmpty()) {
        statementLocksFactory = new SimpleStatementLocksFactory();
        log.info("No services implementing " + serviceName + " found. " + "Using " + SimpleStatementLocksFactory.class.getSimpleName());
    } else if (factories.size() == 1) {
        statementLocksFactory = factories.get(0);
        log.info("Found single implementation of " + serviceName + ". Namely " + statementLocksFactory.getClass().getSimpleName());
    } else {
        throw new IllegalStateException("Found more than one implementation of " + serviceName + ": " + factories);
    }
    statementLocksFactory.initialize(locks, config);
    return statementLocksFactory;
}
Also used : SimpleStatementLocksFactory(org.neo4j.kernel.impl.locking.SimpleStatementLocksFactory) SimpleStatementLocksFactory(org.neo4j.kernel.impl.locking.SimpleStatementLocksFactory) StatementLocksFactory(org.neo4j.kernel.impl.locking.StatementLocksFactory)

Example 2 with SimpleStatementLocksFactory

use of org.neo4j.kernel.impl.locking.SimpleStatementLocksFactory in project neo4j by neo4j.

the class KernelTransactionsTest method newKernelTransactions.

private static KernelTransactions newKernelTransactions(Locks locks, StorageEngine storageEngine, TransactionCommitProcess commitProcess, boolean testKernelTransactions) throws Throwable {
    LifeSupport life = new LifeSupport();
    life.start();
    TransactionIdStore transactionIdStore = mock(TransactionIdStore.class);
    when(transactionIdStore.getLastCommittedTransaction()).thenReturn(new TransactionId(0, 0, 0));
    Tracers tracers = new Tracers("null", NullLog.getInstance(), new Monitors(), mock(JobScheduler.class));
    StatementLocksFactory statementLocksFactory = new SimpleStatementLocksFactory(locks);
    StatementOperationContainer statementOperationsContianer = new StatementOperationContainer(null, null);
    KernelTransactions transactions;
    if (testKernelTransactions) {
        transactions = createTestTransactions(storageEngine, commitProcess, transactionIdStore, tracers, statementLocksFactory, statementOperationsContianer, clock, availabilityGuard);
    } else {
        transactions = createTransactions(storageEngine, commitProcess, transactionIdStore, tracers, statementLocksFactory, statementOperationsContianer, clock, availabilityGuard);
    }
    transactions.start();
    return transactions;
}
Also used : JobScheduler(org.neo4j.kernel.impl.util.JobScheduler) SimpleStatementLocksFactory(org.neo4j.kernel.impl.locking.SimpleStatementLocksFactory) TransactionIdStore(org.neo4j.kernel.impl.transaction.log.TransactionIdStore) StatementLocksFactory(org.neo4j.kernel.impl.locking.StatementLocksFactory) SimpleStatementLocksFactory(org.neo4j.kernel.impl.locking.SimpleStatementLocksFactory) Monitors(org.neo4j.kernel.monitoring.Monitors) LifeSupport(org.neo4j.kernel.lifecycle.LifeSupport) TransactionId(org.neo4j.kernel.impl.store.TransactionId) Tracers(org.neo4j.kernel.monitoring.tracing.Tracers)

Aggregations

SimpleStatementLocksFactory (org.neo4j.kernel.impl.locking.SimpleStatementLocksFactory)2 StatementLocksFactory (org.neo4j.kernel.impl.locking.StatementLocksFactory)2 TransactionId (org.neo4j.kernel.impl.store.TransactionId)1 TransactionIdStore (org.neo4j.kernel.impl.transaction.log.TransactionIdStore)1 JobScheduler (org.neo4j.kernel.impl.util.JobScheduler)1 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)1 Monitors (org.neo4j.kernel.monitoring.Monitors)1 Tracers (org.neo4j.kernel.monitoring.tracing.Tracers)1