Package com.coditory.sherlock
Class DistributedLockMock
- java.lang.Object
-
- com.coditory.sherlock.DistributedLockMock
-
- All Implemented Interfaces:
DistributedLock
public final class DistributedLockMock extends java.lang.Object implements DistributedLock
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacquire()booleanacquire(java.time.Duration duration)booleanacquireForever()intacquireInvocations()static DistributedLockMockalwaysClosedLock(java.lang.String lockId)static DistributedLockMockalwaysOpenedLock(java.lang.String lockId)java.lang.StringgetId()booleanrelease()intreleaseInvocations()static DistributedLockMocksequencedLock(java.lang.String lockId, java.util.List<java.lang.Boolean> results)static DistributedLockMocksequencedLock(java.lang.String lockId, java.util.List<java.lang.Boolean> acquireResults, java.util.List<java.lang.Boolean> releaseResults)static DistributedLockMocksingleStateLock(java.lang.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(java.lang.String lockId)
-
alwaysClosedLock
public static DistributedLockMock alwaysClosedLock(java.lang.String lockId)
-
singleStateLock
public static DistributedLockMock singleStateLock(java.lang.String lockId, boolean result)
-
sequencedLock
public static DistributedLockMock sequencedLock(java.lang.String lockId, java.util.List<java.lang.Boolean> results)
-
sequencedLock
public static DistributedLockMock sequencedLock(java.lang.String lockId, java.util.List<java.lang.Boolean> acquireResults, java.util.List<java.lang.Boolean> releaseResults)
-
getId
public java.lang.String getId()
- Specified by:
getIdin interfaceDistributedLock
-
acquire
public boolean acquire()
- Specified by:
acquirein interfaceDistributedLock
-
acquire
public boolean acquire(java.time.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()
-
-