| Modifier and Type | Class and Description |
|---|---|
static class |
RedissonLock.LockValue |
| Modifier | Constructor and Description |
|---|---|
protected |
RedissonLock(ConnectionManager connectionManager,
String name,
UUID id) |
| Modifier and Type | Method and Description |
|---|---|
void |
delete()
Deletes the object
|
void |
forceUnlock()
Unlocks lock independently of state
|
int |
getHoldCount()
Number of holds on this lock by the current thread
|
String |
getName()
Returns name of object
|
boolean |
isHeldByCurrentThread()
Checks if this lock is held by the current thread
|
boolean |
isLocked()
Checks if this lock locked by any thread in Redisson cluster
|
void |
lock() |
void |
lock(long leaseTime,
TimeUnit unit)
Acquires the lock.
|
void |
lockInterruptibly() |
void |
lockInterruptibly(long leaseTime,
TimeUnit unit)
Acquires the lock.
|
Condition |
newCondition() |
protected <V> io.netty.util.concurrent.Promise<V> |
newPromise() |
boolean |
tryLock() |
boolean |
tryLock(long waitTime,
long leaseTime,
TimeUnit unit)
Returns
true as soon as the lock is acquired. |
boolean |
tryLock(long time,
TimeUnit unit) |
void |
unlock() |
protected RedissonLock(ConnectionManager connectionManager, String name, UUID id)
public void lock(long leaseTime,
TimeUnit unit)
RLockIf the lock is not available then the current thread becomes
disabled for thread scheduling purposes and lies dormant until the
lock has been acquired.
If the lock is acquired, it is held until unlock is invoked,
or until leaseTime milliseconds have passed
since the lock was granted - whichever comes first.
lock in interface RLockleaseTime - the maximum time to hold the lock after granting it,
before automatically releasing it if it hasn't already been released by invoking unlock.
If leaseTime is -1, hold the lock until explicitly unlocked.unit - the time unit of the leaseTime argumentpublic void lockInterruptibly()
throws InterruptedException
lockInterruptibly in interface LockInterruptedExceptionpublic void lockInterruptibly(long leaseTime,
TimeUnit unit)
throws InterruptedException
RLockIf the lock is not available then the current thread becomes
disabled for thread scheduling purposes and lies dormant until the
lock has been acquired.
If the lock is acquired, it is held until unlock is invoked,
or until leaseTime have passed
since the lock was granted - whichever comes first.
lockInterruptibly in interface RLockleaseTime - the maximum time to hold the lock after granting it,
before automatically releasing it if it hasn't already been released by invoking unlock.
If leaseTime is -1, hold the lock until explicitly unlocked.unit - the time unit of the leaseTime argumentInterruptedException - - if the thread is interrupted before or during this method.public boolean tryLock(long waitTime,
long leaseTime,
TimeUnit unit)
throws InterruptedException
RLocktrue as soon as the lock is acquired.
If the lock is currently held by another thread in this or any
other process in the distributed system this method keeps trying
to acquire the lock for up to waitTime before
giving up and returning false. If the lock is acquired,
it is held until unlock is invoked, or until leaseTime
have passed since the lock was granted - whichever comes first.tryLock in interface RLockwaitTime - the maximum time to aquire the lockInterruptedExceptionpublic boolean tryLock(long time,
TimeUnit unit)
throws InterruptedException
tryLock in interface LockInterruptedExceptionpublic Condition newCondition()
newCondition in interface Lockpublic void forceUnlock()
RLockforceUnlock in interface RLockpublic boolean isLocked()
RLockpublic boolean isHeldByCurrentThread()
RLockisHeldByCurrentThread in interface RLocktrue if held by current thread
otherwise falsepublic int getHoldCount()
RLockgetHoldCount in interface RLock0 if this lock is not held by current threadpublic void delete()
RObjectprotected <V> io.netty.util.concurrent.Promise<V> newPromise()
Copyright © 2014–2015. All rights reserved.