Search in sources :

Example 6 with LockGroup

use of org.neo4j.lock.LockGroup in project neo4j by neo4j.

the class LockGroupTest method shouldReleaseAllLocksWhenExitingTheLockGroupRegion.

@Test
void shouldReleaseAllLocksWhenExitingTheLockGroupRegion() {
    // given
    Lock lock1 = mock(Lock.class);
    Lock lock2 = mock(Lock.class);
    Lock lock3 = mock(Lock.class);
    // when
    try (LockGroup locks = new LockGroup()) {
        locks.add(lock1);
        locks.add(lock2);
        locks.add(lock3);
    }
    // then
    verify(lock1).release();
    verify(lock2).release();
    verify(lock3).release();
}
Also used : LockGroup(org.neo4j.lock.LockGroup) Lock(org.neo4j.lock.Lock) Test(org.junit.jupiter.api.Test)

Aggregations

LockGroup (org.neo4j.lock.LockGroup)6 Test (org.junit.jupiter.api.Test)2 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Config (org.neo4j.configuration.Config)1 DefaultIdGeneratorFactory (org.neo4j.internal.id.DefaultIdGeneratorFactory)1 NodeCommand (org.neo4j.internal.recordstorage.Command.NodeCommand)1 ConsistencyCheckingApplier (org.neo4j.internal.recordstorage.ConsistencyCheckingApplierFactory.ConsistencyCheckingApplier)1 IndexDescriptor (org.neo4j.internal.schema.IndexDescriptor)1 DatabaseLayout (org.neo4j.io.layout.DatabaseLayout)1 RelationshipStore (org.neo4j.kernel.impl.store.RelationshipStore)1 StoreFactory (org.neo4j.kernel.impl.store.StoreFactory)1 SchemaRecord (org.neo4j.kernel.impl.store.record.SchemaRecord)1 Lock (org.neo4j.lock.Lock)1 CommandsToApply (org.neo4j.storageengine.api.CommandsToApply)1 IndexUpdateListener (org.neo4j.storageengine.api.IndexUpdateListener)1