public interface RLockAsync
Modifier and Type | Method and Description |
---|---|
RFuture<Boolean> |
forceUnlockAsync()
Unlocks the lock independently of state
|
RFuture<Integer> |
getHoldCountAsync()
Number of holds on this lock by the current thread
|
RFuture<Boolean> |
isLockedAsync()
Checks if this lock locked by any thread
|
RFuture<Void> |
lockAsync()
Acquires the lock.
|
RFuture<Void> |
lockAsync(long threadId)
Acquires the lock by thread with specified
threadId . |
RFuture<Void> |
lockAsync(long leaseTime,
TimeUnit unit)
Acquires the lock.
|
RFuture<Void> |
lockAsync(long leaseTime,
TimeUnit unit,
long threadId)
Acquires the lock by thread with specified
threadId . |
RFuture<Long> |
remainTimeToLiveAsync()
Remaining time to live of this lock
|
RFuture<Boolean> |
tryLockAsync()
Tries to acquire the lock.
|
RFuture<Boolean> |
tryLockAsync(long threadId)
Tries to acquire the lock by thread with specified
threadId . |
RFuture<Boolean> |
tryLockAsync(long waitTime,
long leaseTime,
TimeUnit unit)
Tries to acquire the lock.
|
RFuture<Boolean> |
tryLockAsync(long waitTime,
long leaseTime,
TimeUnit unit,
long threadId)
Tries to acquire the lock by thread with specified
threadId . |
RFuture<Boolean> |
tryLockAsync(long waitTime,
TimeUnit unit)
Tries to acquire the lock.
|
RFuture<Void> |
unlockAsync()
Unlocks the lock
|
RFuture<Void> |
unlockAsync(long threadId)
Unlocks the lock.
|
RFuture<Boolean> forceUnlockAsync()
true
if lock existed and now unlocked otherwise false
RFuture<Void> unlockAsync(long threadId)
IllegalMonitorStateException
if lock isn't locked by thread with specified threadId
.threadId
- id of threadRFuture<Boolean> tryLockAsync()
true
if lock acquired otherwise false
RFuture<Void> lockAsync(long threadId)
threadId
.threadId
- id of threadRFuture<Void> lockAsync(long leaseTime, TimeUnit unit)
If 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.
leaseTime
- 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
argumentRFuture<Void> lockAsync(long leaseTime, TimeUnit unit, long threadId)
threadId
.
If 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.
leaseTime
- 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
argumentthreadId
- id of threadRFuture<Boolean> tryLockAsync(long threadId)
threadId
.threadId
- id of threadtrue
if lock acquired otherwise false
RFuture<Boolean> tryLockAsync(long waitTime, TimeUnit unit)
waitTime
time interval to acquire it.waitTime
- interval to acquire lockunit
- the time unit of the waitTime
argumenttrue
if lock acquired otherwise false
RFuture<Boolean> tryLockAsync(long waitTime, long leaseTime, TimeUnit unit)
waitTime
time interval to acquire it.
Lock will be release automatically after defined leaseTime
interval.waitTime
- time interval to acquire lockleaseTime
- time interval after which lock will be released automaticallyunit
- the time unit of the waitTime
and leaseTime
argumentstrue
if lock acquired otherwise false
RFuture<Boolean> tryLockAsync(long waitTime, long leaseTime, TimeUnit unit, long threadId)
threadId
. If the lock is not available waits
up to specified waitTime
time interval to acquire it.
Lock will be release automatically after defined leaseTime
interval.threadId
- id of threadwaitTime
- time interval to acquire lockleaseTime
- time interval after which lock will be released automaticallyunit
- the time unit of the waitTime
and leaseTime
argumentstrue
if lock acquired otherwise false
RFuture<Integer> getHoldCountAsync()
0
if this lock is not held by current threadRFuture<Boolean> isLockedAsync()
true
if locked otherwise false
Copyright © 2014–2019 The Redisson Project. All rights reserved.