Class DefaultDistributedLock
- java.lang.Object
-
- org.apache.shardingsphere.mode.repository.cluster.lock.impl.DefaultDistributedLock
-
- All Implemented Interfaces:
DistributedLock
public final class DefaultDistributedLock extends Object implements DistributedLock
Default distributed lock.
-
-
Constructor Summary
Constructors Constructor Description DefaultDistributedLock(String lockKey, ClusterPersistRepository client, DefaultLockTypedProperties props)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleantryLock(long timeoutMillis)Try lock.voidunlock()Unlock.
-
-
-
Constructor Detail
-
DefaultDistributedLock
public DefaultDistributedLock(String lockKey, ClusterPersistRepository client, DefaultLockTypedProperties props)
-
-
Method Detail
-
tryLock
public boolean tryLock(long timeoutMillis)
Description copied from interface:DistributedLockTry lock.- Specified by:
tryLockin interfaceDistributedLock- Parameters:
timeoutMillis- timeout millis- Returns:
- is locked or not
-
unlock
public void unlock()
Description copied from interface:DistributedLockUnlock.- Specified by:
unlockin interfaceDistributedLock
-
-