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;
}
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;
}
Aggregations