@Test public void canAcquireLock() throws CheckAndSetException { service.acquireBackupLock(TEST_REASON); verify(lockStore, times(1)).acquireBackupLock(TEST_REASON); }
@Override public PersistentLockId acquireBackupLock(String reason) { WebPreconditions.checkNotNull(reason, "Please provide a reason for acquiring the lock."); return PersistentLockId.of(lockStore.acquireBackupLock(reason).instanceId()); }
KvsBackedPersistentLockService implements PersistentLockService { @Override public PersistentLockId acquireBackupLock(String reason) { WebPreconditions.checkNotNull(reason, "Please provide a reason for acquiring the lock."); return PersistentLockId.of(lockStore.acquireBackupLock(reason).instanceId()); } }
KvsBackedPersistentLockService implements PersistentLockService { @Override public PersistentLockId acquireBackupLock(String reason) { WebPreconditions.checkNotNull(reason, "Please provide a reason for acquiring the lock."); return PersistentLockId.of(lockStore.acquireBackupLock(reason).instanceId()); } @VisibleForTesting  KvsBackedPersistentLockService(LockStore lockStore); }
KvsBackedPersistentLockService implements PersistentLockService { @Override public PersistentLockId acquireBackupLock(String reason) { WebPreconditions.checkNotNull(reason, "Please provide a reason for acquiring the lock."); return PersistentLockId.of(lockStore.acquireBackupLock(reason).instanceId()); } @VisibleForTesting  KvsBackedPersistentLockService(LockStore lockStore); static PersistentLockService create(KeyValueService kvs); static PersistentLockService create(KeyValueService kvs, boolean initializeAsync); @Override PersistentLockId acquireBackupLock(String reason); @Override void releaseBackupLock(PersistentLockId lockId); }
KvsBackedPersistentLockService implements PersistentLockService { @Override public PersistentLockId acquireBackupLock(String reason) { WebPreconditions.checkNotNull(reason, "Please provide a reason for acquiring the lock."); return PersistentLockId.of(lockStore.acquireBackupLock(reason).instanceId()); } @VisibleForTesting  KvsBackedPersistentLockService(LockStore lockStore); static PersistentLockService create(KeyValueService kvs); static PersistentLockService create(KeyValueService kvs, boolean initializeAsync); @Override PersistentLockId acquireBackupLock(String reason); @Override void releaseBackupLock(PersistentLockId lockId);  }