Class InMemoryLockProvider
- java.lang.Object
-
- cn.boboweike.carrot.lock.inmemory.InMemoryLockProvider
-
- All Implemented Interfaces:
LockProvider
public class InMemoryLockProvider extends Object implements LockProvider
In memory lock that is suitable only for tests and running application locally.
-
-
Field Summary
-
Fields inherited from interface cn.boboweike.carrot.lock.LockProvider
LOCK_UNTIL, LOCKED_AT, LOCKED_BY
-
-
Constructor Summary
Constructors Constructor Description InMemoryLockProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanextend(String lockName, int durationInSeconds, String lockedBy)booleanlock(String lockName, int durationInSeconds, String lockedBy)booleanunlock(String lockName)
-
-
-
Method Detail
-
lock
public boolean lock(String lockName, int durationInSeconds, String lockedBy)
- Specified by:
lockin interfaceLockProvider
-
extend
public boolean extend(String lockName, int durationInSeconds, String lockedBy)
- Specified by:
extendin interfaceLockProvider
-
unlock
public boolean unlock(String lockName)
- Specified by:
unlockin interfaceLockProvider
-
-