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 boolean
acquire()
boolean
acquire(java.time.Duration duration)
boolean
acquireForever()
int
acquireInvocations()
static DistributedLockMock
alwaysClosedLock(java.lang.String lockId)
static DistributedLockMock
alwaysOpenedLock(java.lang.String lockId)
java.lang.String
getId()
boolean
release()
int
releaseInvocations()
static DistributedLockMock
sequencedLock(java.lang.String lockId, java.util.List<java.lang.Boolean> results)
static DistributedLockMock
sequencedLock(java.lang.String lockId, java.util.List<java.lang.Boolean> acquireResults, java.util.List<java.lang.Boolean> releaseResults)
static DistributedLockMock
singleStateLock(java.lang.String lockId, boolean result)
boolean
wasAcquired()
boolean
wasReleased()
-
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:
getId
in interfaceDistributedLock
-
acquire
public boolean acquire()
- Specified by:
acquire
in interfaceDistributedLock
-
acquire
public boolean acquire(java.time.Duration duration)
- Specified by:
acquire
in interfaceDistributedLock
-
acquireForever
public boolean acquireForever()
- Specified by:
acquireForever
in interfaceDistributedLock
-
release
public boolean release()
- Specified by:
release
in interfaceDistributedLock
-
wasAcquired
public boolean wasAcquired()
-
wasReleased
public boolean wasReleased()
-
releaseInvocations
public int releaseInvocations()
-
acquireInvocations
public int acquireInvocations()
-
-