Package org.redisson.api
Interface RLockAsync
-
- All Known Subinterfaces:
RLock
- All Known Implementing Classes:
RedissonBaseLock,RedissonFairLock,RedissonLock,RedissonMultiLock,RedissonReadLock,RedissonRedLock,RedissonSpinLock,RedissonTransactionalLock,RedissonWriteLock
public interface RLockAsyncAsync interface for Lock object- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RFuture<Boolean>forceUnlockAsync()Unlocks the lock independently of its stateRFuture<Integer>getHoldCountAsync()Number of holds on this lock by the current threadRFuture<Boolean>isLockedAsync()Checks if the lock locked by any threadRFuture<Void>lockAsync()Acquires the lock.RFuture<Void>lockAsync(long threadId)Acquires the lock by thread with definedthreadId.RFuture<Void>lockAsync(long leaseTime, TimeUnit unit)Acquires the lock with definedleaseTime.RFuture<Void>lockAsync(long leaseTime, TimeUnit unit, long threadId)Acquires the lock with definedleaseTimeandthreadId.RFuture<Long>remainTimeToLiveAsync()Remaining time to live of the lockRFuture<Boolean>tryLockAsync()Tries to acquire the lock.RFuture<Boolean>tryLockAsync(long threadId)Tries to acquire the lock by thread with specifiedthreadId.RFuture<Boolean>tryLockAsync(long waitTime, long leaseTime, TimeUnit unit)Tries to acquire the lock with definedleaseTime.RFuture<Boolean>tryLockAsync(long waitTime, long leaseTime, TimeUnit unit, long threadId)Tries to acquire the lock by thread with specifiedthreadIdandleaseTime.RFuture<Boolean>tryLockAsync(long waitTime, TimeUnit unit)Tries to acquire the lock.RFuture<Void>unlockAsync()Unlocks the lockRFuture<Void>unlockAsync(long threadId)Unlocks the lock.
-
-
-
Method Detail
-
forceUnlockAsync
RFuture<Boolean> forceUnlockAsync()
Unlocks the lock independently of its state- Returns:
trueif lock existed and now unlocked otherwisefalse
-
unlockAsync
RFuture<Void> unlockAsync(long threadId)
Unlocks the lock. ThrowsIllegalMonitorStateExceptionif lock isn't locked by thread with specifiedthreadId.- Parameters:
threadId- id of thread- Returns:
- void
-
tryLockAsync
RFuture<Boolean> tryLockAsync()
Tries to acquire the lock.- Returns:
trueif lock acquired otherwisefalse
-
lockAsync
RFuture<Void> lockAsync()
Acquires the lock. Waits if necessary until lock became available.- Returns:
- void
-
lockAsync
RFuture<Void> lockAsync(long threadId)
Acquires the lock by thread with definedthreadId. Waits if necessary until lock became available.- Parameters:
threadId- id of thread- Returns:
- void
-
lockAsync
RFuture<Void> lockAsync(long leaseTime, TimeUnit unit)
Acquires the lock with definedleaseTime. Waits if necessary until lock became available. Lock will be released automatically after definedleaseTimeinterval.- Parameters:
leaseTime- the maximum time to hold the lock after it's acquisition, if it hasn't already been released by invokingunlock. If leaseTime is -1, hold the lock until explicitly unlocked.unit- the time unit- Returns:
- void
-
lockAsync
RFuture<Void> lockAsync(long leaseTime, TimeUnit unit, long threadId)
Acquires the lock with definedleaseTimeandthreadId. Waits if necessary until lock became available. Lock will be released automatically after definedleaseTimeinterval.- Parameters:
leaseTime- the maximum time to hold the lock after it's acquisition, if it hasn't already been released by invokingunlock. If leaseTime is -1, hold the lock until explicitly unlocked.unit- the time unitthreadId- id of thread- Returns:
- void
-
tryLockAsync
RFuture<Boolean> tryLockAsync(long threadId)
Tries to acquire the lock by thread with specifiedthreadId.- Parameters:
threadId- id of thread- Returns:
trueif lock acquired otherwisefalse
-
tryLockAsync
RFuture<Boolean> tryLockAsync(long waitTime, TimeUnit unit)
Tries to acquire the lock. Waits up to definedwaitTimeif necessary until the lock became available.- Parameters:
waitTime- the maximum time to acquire the lockunit- time unit- Returns:
trueif lock is successfully acquired, otherwisefalseif lock is already set.
-
tryLockAsync
RFuture<Boolean> tryLockAsync(long waitTime, long leaseTime, TimeUnit unit)
Tries to acquire the lock with definedleaseTime. Waits up to definedwaitTimeif necessary until the lock became available. Lock will be released automatically after definedleaseTimeinterval.- Parameters:
waitTime- the maximum time to acquire the lockleaseTime- lease timeunit- time unit- Returns:
trueif lock is successfully acquired, otherwisefalseif lock is already set.
-
tryLockAsync
RFuture<Boolean> tryLockAsync(long waitTime, long leaseTime, TimeUnit unit, long threadId)
Tries to acquire the lock by thread with specifiedthreadIdandleaseTime. Waits up to definedwaitTimeif necessary until the lock became available. Lock will be released automatically after definedleaseTimeinterval.- Parameters:
threadId- id of threadwaitTime- time interval to acquire lockleaseTime- time interval after which lock will be released automaticallyunit- the time unit of thewaitTimeandleaseTimearguments- Returns:
trueif lock acquired otherwisefalse
-
getHoldCountAsync
RFuture<Integer> getHoldCountAsync()
Number of holds on this lock by the current thread- Returns:
- holds or
0if this lock is not held by current thread
-
isLockedAsync
RFuture<Boolean> isLockedAsync()
Checks if the lock locked by any thread- Returns:
trueif locked otherwisefalse
-
-