Search in sources :

Example 1 with NoOpClient

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

the class TransactionRecordStateTest method newTransactionRecordState.

private TransactionRecordState newTransactionRecordState(NeoStores neoStores) {
    Loaders loaders = new Loaders(neoStores);
    recordChangeSet = new RecordChangeSet(loaders);
    PropertyTraverser propertyTraverser = new PropertyTraverser();
    RelationshipGroupGetter relationshipGroupGetter = new RelationshipGroupGetter(neoStores.getRelationshipGroupStore());
    PropertyDeleter propertyDeleter = new PropertyDeleter(propertyTraverser);
    return new TransactionRecordState(neoStores, integrityValidator, recordChangeSet, 0, new NoOpClient(), new RelationshipCreator(relationshipGroupGetter, neoStores.getRelationshipGroupStore().getStoreHeaderInt()), new RelationshipDeleter(relationshipGroupGetter, propertyDeleter), new PropertyCreator(neoStores.getPropertyStore(), propertyTraverser), propertyDeleter);
}
Also used : NoOpClient(org.neo4j.kernel.impl.locking.NoOpClient)

Example 2 with NoOpClient

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

the class KernelTransactionImplementationTest method shouldIncrementReuseCounterOnReuse.

@Test
public void shouldIncrementReuseCounterOnReuse() throws Exception {
    // GIVEN
    KernelTransactionImplementation transaction = newTransaction(securityContext());
    int reuseCount = transaction.getReuseCount();
    // WHEN
    transaction.close();
    SimpleStatementLocks statementLocks = new SimpleStatementLocks(new NoOpClient());
    transaction.initialize(1, BASE_TX_COMMIT_TIMESTAMP, statementLocks, KernelTransaction.Type.implicit, securityContext(), 0L);
    // THEN
    assertEquals(reuseCount + 1, transaction.getReuseCount());
}
Also used : NoOpClient(org.neo4j.kernel.impl.locking.NoOpClient) SimpleStatementLocks(org.neo4j.kernel.impl.locking.SimpleStatementLocks) Test(org.junit.Test)

Example 3 with NoOpClient

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

the class KernelTransactionFactory method kernelTransactionWithInternals.

static Instances kernelTransactionWithInternals(SecurityContext securityContext) {
    TransactionHeaderInformation headerInformation = new TransactionHeaderInformation(-1, -1, new byte[0]);
    TransactionHeaderInformationFactory headerInformationFactory = mock(TransactionHeaderInformationFactory.class);
    when(headerInformationFactory.create()).thenReturn(headerInformation);
    StorageEngine storageEngine = mock(StorageEngine.class);
    StoreReadLayer storeReadLayer = mock(StoreReadLayer.class);
    StorageStatement storageStatement = mock(StorageStatement.class);
    when(storeReadLayer.newStatement()).thenReturn(storageStatement);
    when(storageEngine.storeReadLayer()).thenReturn(storeReadLayer);
    KernelTransactionImplementation transaction = new KernelTransactionImplementation(mock(StatementOperationContainer.class), mock(SchemaWriteGuard.class), new TransactionHooks(), mock(ConstraintIndexCreator.class), new Procedures(), headerInformationFactory, mock(TransactionRepresentationCommitProcess.class), mock(TransactionMonitor.class), mock(Supplier.class), mock(Pool.class), Clocks.systemClock(), NULL, LockTracer.NONE, PageCursorTracerSupplier.NULL, storageEngine, new CanWrite());
    StatementLocks statementLocks = new SimpleStatementLocks(new NoOpClient());
    transaction.initialize(0, 0, statementLocks, KernelTransaction.Type.implicit, securityContext, 0L);
    return new Instances(transaction, storageEngine, storeReadLayer, storageStatement);
}
Also used : StorageStatement(org.neo4j.storageengine.api.StorageStatement) TransactionHeaderInformation(org.neo4j.kernel.impl.api.TransactionHeaderInformation) StoreReadLayer(org.neo4j.storageengine.api.StoreReadLayer) TransactionHooks(org.neo4j.kernel.impl.api.TransactionHooks) Procedures(org.neo4j.kernel.impl.proc.Procedures) TransactionHeaderInformationFactory(org.neo4j.kernel.impl.transaction.TransactionHeaderInformationFactory) StorageEngine(org.neo4j.storageengine.api.StorageEngine) StatementOperationContainer(org.neo4j.kernel.impl.api.StatementOperationContainer) CanWrite(org.neo4j.kernel.impl.factory.CanWrite) ConstraintIndexCreator(org.neo4j.kernel.impl.api.state.ConstraintIndexCreator) SchemaWriteGuard(org.neo4j.kernel.impl.api.SchemaWriteGuard) NoOpClient(org.neo4j.kernel.impl.locking.NoOpClient) KernelTransactionImplementation(org.neo4j.kernel.impl.api.KernelTransactionImplementation) TransactionRepresentationCommitProcess(org.neo4j.kernel.impl.api.TransactionRepresentationCommitProcess) SimpleStatementLocks(org.neo4j.kernel.impl.locking.SimpleStatementLocks) StatementLocks(org.neo4j.kernel.impl.locking.StatementLocks) PageCursorTracerSupplier(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracerSupplier) Supplier(java.util.function.Supplier) Pool(org.neo4j.collection.pool.Pool) SimpleStatementLocks(org.neo4j.kernel.impl.locking.SimpleStatementLocks) TransactionMonitor(org.neo4j.kernel.impl.transaction.TransactionMonitor)

Example 4 with NoOpClient

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

the class KernelTransactionImplementationTest method initializeAndClose.

private void initializeAndClose(KernelTransactionImplementation tx, int times) throws Exception {
    for (int i = 0; i < times; i++) {
        SimpleStatementLocks statementLocks = new SimpleStatementLocks(new NoOpClient());
        tx.initialize(i + 10, i + 10, statementLocks, KernelTransaction.Type.implicit, securityContext(), 0L);
        tx.close();
    }
}
Also used : NoOpClient(org.neo4j.kernel.impl.locking.NoOpClient) SimpleStatementLocks(org.neo4j.kernel.impl.locking.SimpleStatementLocks)

Aggregations

NoOpClient (org.neo4j.kernel.impl.locking.NoOpClient)4 SimpleStatementLocks (org.neo4j.kernel.impl.locking.SimpleStatementLocks)3 Supplier (java.util.function.Supplier)1 Test (org.junit.Test)1 Pool (org.neo4j.collection.pool.Pool)1 PageCursorTracerSupplier (org.neo4j.io.pagecache.tracing.cursor.PageCursorTracerSupplier)1 KernelTransactionImplementation (org.neo4j.kernel.impl.api.KernelTransactionImplementation)1 SchemaWriteGuard (org.neo4j.kernel.impl.api.SchemaWriteGuard)1 StatementOperationContainer (org.neo4j.kernel.impl.api.StatementOperationContainer)1 TransactionHeaderInformation (org.neo4j.kernel.impl.api.TransactionHeaderInformation)1 TransactionHooks (org.neo4j.kernel.impl.api.TransactionHooks)1 TransactionRepresentationCommitProcess (org.neo4j.kernel.impl.api.TransactionRepresentationCommitProcess)1 ConstraintIndexCreator (org.neo4j.kernel.impl.api.state.ConstraintIndexCreator)1 CanWrite (org.neo4j.kernel.impl.factory.CanWrite)1 StatementLocks (org.neo4j.kernel.impl.locking.StatementLocks)1 Procedures (org.neo4j.kernel.impl.proc.Procedures)1 TransactionHeaderInformationFactory (org.neo4j.kernel.impl.transaction.TransactionHeaderInformationFactory)1 TransactionMonitor (org.neo4j.kernel.impl.transaction.TransactionMonitor)1 StorageEngine (org.neo4j.storageengine.api.StorageEngine)1 StorageStatement (org.neo4j.storageengine.api.StorageStatement)1