use of com.palantir.atlasdb.persistentlock.NoOpPersistentLockService in project atlasdb by palantir.
the class PersistentLockManagerTest method noOpPersistentLockCanLockTwice.
@Test
public void noOpPersistentLockCanLockTwice() {
PersistentLockManager noOpManager = new PersistentLockManager(new NoOpPersistentLockService(), 0L);
assertTrue("NoOpPersistentLockService should return true when acquiring lock", noOpManager.tryAcquirePersistentLock());
assertTrue("NoOpPersistentLockService should return true when acquiring lock for the second time", noOpManager.tryAcquirePersistentLock());
}
use of com.palantir.atlasdb.persistentlock.NoOpPersistentLockService in project atlasdb by palantir.
the class TransactionManagers method createAndRegisterPersistentLockService.
private static PersistentLockService createAndRegisterPersistentLockService(KeyValueService kvs, Consumer<Object> env, boolean initializeAsync) {
if (!kvs.supportsCheckAndSet()) {
return new NoOpPersistentLockService();
}
PersistentLockService pls = KvsBackedPersistentLockService.create(kvs, initializeAsync);
env.accept(pls);
env.accept(new CheckAndSetExceptionMapper());
return pls;
}
use of com.palantir.atlasdb.persistentlock.NoOpPersistentLockService in project atlasdb by palantir.
the class PersistentLockManagerTest method noOpPersistentLockDoesNotThrow.
@Test
public void noOpPersistentLockDoesNotThrow() {
PersistentLockManager noOpManager = new PersistentLockManager(new NoOpPersistentLockService(), 0L);
assertTrue("NoOpPersistentLockService should return true when acquiring lock", noOpManager.tryAcquirePersistentLock());
noOpManager.releasePersistentLock();
}
Aggregations