Package org.redisson
Class RedissonMultiLock
- java.lang.Object
-
- org.redisson.RedissonMultiLock
-
- All Implemented Interfaces:
Lock
- Direct Known Subclasses:
RedissonRedLock
public class RedissonMultiLock extends Object implements Lock
Groups multiple independent locks and manages them as one lock.- Author:
- Nikita Koksharov
-
-
Constructor Summary
Constructors Constructor Description RedissonMultiLock(RLock... locks)
Creates instance with multipleRLock
objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
calcLockWaitTime(long remainTime)
protected void
checkRemainTimeAsync(ListIterator<RLock> iterator, List<RLock> acquiredLocks, RPromise<Boolean> result, long lockWaitTime, long waitTime, long leaseTime, long newLeaseTime, AtomicLong remainTime, AtomicLong time, AtomicInteger failedLocksLimit, TimeUnit unit, long threadId)
protected int
failedLocksLimit()
void
lock()
void
lock(long leaseTime, TimeUnit unit)
RFuture<Void>
lockAsync(long leaseTime, TimeUnit unit)
void
lockInterruptibly()
void
lockInterruptibly(long leaseTime, TimeUnit unit)
Condition
newCondition()
boolean
tryLock()
boolean
tryLock(long waitTime, long leaseTime, TimeUnit unit)
boolean
tryLock(long waitTime, TimeUnit unit)
RFuture<Boolean>
tryLockAsync(long waitTime, long leaseTime, TimeUnit unit)
protected void
tryLockAsync(long leaseTime, TimeUnit unit, long waitTime, RPromise<Void> result)
void
unlock()
RFuture<Void>
unlockAsync(long threadId)
protected void
unlockInner(Collection<RLock> locks)
protected RFuture<Void>
unlockInnerAsync(Collection<RLock> locks, long threadId)
-
-
-
Method Detail
-
lock
public void lock(long leaseTime, TimeUnit unit)
-
tryLockAsync
protected void tryLockAsync(long leaseTime, TimeUnit unit, long waitTime, RPromise<Void> result)
-
lockInterruptibly
public void lockInterruptibly() throws InterruptedException
- Specified by:
lockInterruptibly
in interfaceLock
- Throws:
InterruptedException
-
lockInterruptibly
public void lockInterruptibly(long leaseTime, TimeUnit unit) throws InterruptedException
- Throws:
InterruptedException
-
unlockInner
protected void unlockInner(Collection<RLock> locks)
-
unlockInnerAsync
protected RFuture<Void> unlockInnerAsync(Collection<RLock> locks, long threadId)
-
tryLock
public boolean tryLock(long waitTime, TimeUnit unit) throws InterruptedException
- Specified by:
tryLock
in interfaceLock
- Throws:
InterruptedException
-
failedLocksLimit
protected int failedLocksLimit()
-
tryLock
public boolean tryLock(long waitTime, long leaseTime, TimeUnit unit) throws InterruptedException
- Throws:
InterruptedException
-
checkRemainTimeAsync
protected void checkRemainTimeAsync(ListIterator<RLock> iterator, List<RLock> acquiredLocks, RPromise<Boolean> result, long lockWaitTime, long waitTime, long leaseTime, long newLeaseTime, AtomicLong remainTime, AtomicLong time, AtomicInteger failedLocksLimit, TimeUnit unit, long threadId)
-
calcLockWaitTime
protected long calcLockWaitTime(long remainTime)
-
newCondition
public Condition newCondition()
- Specified by:
newCondition
in interfaceLock
-
-