Package com.coditory.sherlock
Class DistributedLockMock
- java.lang.Object
-
- com.coditory.sherlock.DistributedLockMock
-
- All Implemented Interfaces:
DistributedLock
public final class DistributedLockMock extends Object implements DistributedLock
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacquire()booleanacquire(Duration duration)booleanacquireForever()intacquireInvocations()static DistributedLockMockalwaysClosedLock(String lockId)static DistributedLockMockalwaysOpenedLock(String lockId)StringgetId()booleanrelease()intreleaseInvocations()static DistributedLockMocksequencedLock(String lockId, List<Boolean> results)static DistributedLockMocksequencedLock(String lockId, List<Boolean> acquireResults, List<Boolean> releaseResults)static DistributedLockMocksingleStateLock(String lockId, boolean result)booleanwasAcquired()booleanwasReleased()-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.coditory.sherlock.DistributedLock
acquireAndExecute, acquireAndExecute, acquireForeverAndExecute, releaseAndExecute
-
-
-
-
Method Detail
-
alwaysOpenedLock
public static DistributedLockMock alwaysOpenedLock(String lockId)
-
alwaysClosedLock
public static DistributedLockMock alwaysClosedLock(String lockId)
-
singleStateLock
public static DistributedLockMock singleStateLock(String lockId, boolean result)
-
sequencedLock
public static DistributedLockMock sequencedLock(String lockId, List<Boolean> results)
-
sequencedLock
public static DistributedLockMock sequencedLock(String lockId, List<Boolean> acquireResults, List<Boolean> releaseResults)
-
getId
public String getId()
- Specified by:
getIdin interfaceDistributedLock
-
acquire
public boolean acquire()
- Specified by:
acquirein interfaceDistributedLock
-
acquire
public boolean acquire(Duration duration)
- Specified by:
acquirein interfaceDistributedLock
-
acquireForever
public boolean acquireForever()
- Specified by:
acquireForeverin interfaceDistributedLock
-
release
public boolean release()
- Specified by:
releasein interfaceDistributedLock
-
wasAcquired
public boolean wasAcquired()
-
wasReleased
public boolean wasReleased()
-
releaseInvocations
public int releaseInvocations()
-
acquireInvocations
public int acquireInvocations()
-
-