public interface RLockRx
Modifier and Type | Method and Description |
---|---|
io.reactivex.Single<Boolean> |
forceUnlock()
Unlocks the lock independently of its state
|
io.reactivex.Single<Integer> |
getHoldCount()
Number of holds on this lock by the current thread
|
String |
getName()
Returns name of object
|
io.reactivex.Single<Boolean> |
isLocked()
Checks if the lock locked by any thread
|
io.reactivex.Completable |
lock()
Acquires the lock.
|
io.reactivex.Completable |
lock(long threadId)
Acquires the lock by thread with defined
threadId . |
io.reactivex.Completable |
lock(long leaseTime,
TimeUnit unit)
Acquires the lock with defined
leaseTime . |
io.reactivex.Completable |
lock(long leaseTime,
TimeUnit unit,
long threadId)
Acquires the lock with defined
leaseTime and threadId . |
io.reactivex.Single<Long> |
remainTimeToLive()
Remaining time to live of the lock
|
io.reactivex.Single<Boolean> |
tryLock()
Tries to acquire the lock.
|
io.reactivex.Single<Boolean> |
tryLock(long threadId)
Tries to acquire the lock by thread with specified
threadId . |
io.reactivex.Single<Boolean> |
tryLock(long waitTime,
long leaseTime,
TimeUnit unit)
Tries to acquire the lock with defined
leaseTime . |
io.reactivex.Single<Boolean> |
tryLock(long waitTime,
long leaseTime,
TimeUnit unit,
long threadId)
Tries to acquire the lock by thread with specified
threadId and leaseTime . |
io.reactivex.Single<Boolean> |
tryLock(long waitTime,
TimeUnit unit)
Tries to acquire the lock.
|
io.reactivex.Completable |
unlock()
Unlocks the lock
|
io.reactivex.Completable |
unlock(long threadId)
Unlocks the lock.
|
String getName()
io.reactivex.Single<Boolean> forceUnlock()
true
if lock existed and now unlocked
otherwise false
io.reactivex.Completable unlock()
io.reactivex.Completable unlock(long threadId)
IllegalMonitorStateException
if lock isn't locked by thread with specified threadId
.threadId
- id of threadio.reactivex.Single<Boolean> tryLock()
true
if lock acquired otherwise false
io.reactivex.Completable lock()
io.reactivex.Completable lock(long threadId)
threadId
.
Waits if necessary until lock became available.threadId
- id of threadio.reactivex.Completable lock(long leaseTime, TimeUnit unit)
leaseTime
.
Waits if necessary until lock became available.
Lock will be released automatically after defined leaseTime
interval.leaseTime
- the maximum time to hold the lock after it's acquisition,
if it hasn't already been released by invoking unlock
.
If leaseTime is -1, hold the lock until explicitly unlocked.unit
- the time unitio.reactivex.Completable lock(long leaseTime, TimeUnit unit, long threadId)
leaseTime
and threadId
.
Waits if necessary until lock became available.
Lock will be released automatically after defined leaseTime
interval.leaseTime
- the maximum time to hold the lock after it's acquisition,
if it hasn't already been released by invoking unlock
.
If leaseTime is -1, hold the lock until explicitly unlocked.unit
- the time unitthreadId
- id of threadio.reactivex.Single<Boolean> tryLock(long threadId)
threadId
.threadId
- id of threadtrue
if lock acquired otherwise false
io.reactivex.Single<Boolean> tryLock(long waitTime, TimeUnit unit)
waitTime
if necessary until the lock became available.waitTime
- the maximum time to acquire the lockunit
- time unittrue
if lock is successfully acquired,
otherwise false
if lock is already set.io.reactivex.Single<Boolean> tryLock(long waitTime, long leaseTime, TimeUnit unit)
leaseTime
.
Waits up to defined waitTime
if necessary until the lock became available.
Lock will be released automatically after defined leaseTime
interval.waitTime
- the maximum time to acquire the lockleaseTime
- lease timeunit
- time unittrue
if lock is successfully acquired,
otherwise false
if lock is already set.io.reactivex.Single<Boolean> tryLock(long waitTime, long leaseTime, TimeUnit unit, long threadId)
threadId
and leaseTime
.
Waits up to defined waitTime
if necessary until the lock became available.
Lock will be released 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
io.reactivex.Single<Integer> getHoldCount()
0
if this lock is not held by current threadio.reactivex.Single<Boolean> isLocked()
true
if locked otherwise false
io.reactivex.Single<Long> remainTimeToLive()
Copyright © 2014–2020 Redisson. All rights reserved.