public interface RLockRx
| Modifier and Type | Method and Description |
|---|---|
io.reactivex.Single<Boolean> |
forceUnlock()
Unlocks the lock independently of 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 this lock locked by any thread
|
io.reactivex.Completable |
lock()
Acquires the lock.
|
io.reactivex.Completable |
lock(long threadId)
Acquires the lock by thread with specified
threadId. |
io.reactivex.Completable |
lock(long leaseTime,
TimeUnit unit)
Acquires the lock.
|
io.reactivex.Completable |
lock(long leaseTime,
TimeUnit unit,
long threadId)
Acquires the lock by thread with specified
threadId. |
io.reactivex.Single<Long> |
remainTimeToLive()
Remaining time to live of this 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.
|
io.reactivex.Single<Boolean> |
tryLock(long waitTime,
long leaseTime,
TimeUnit unit,
long threadId)
Tries to acquire the lock by thread with specified
threadId. |
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 unlocked otherwise falseio.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 falseio.reactivex.Completable lock()
io.reactivex.Completable lock(long threadId)
threadId.threadId - id of threadio.reactivex.Completable lock(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 argumentio.reactivex.Completable lock(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 threadio.reactivex.Single<Boolean> tryLock(long threadId)
threadId.threadId - id of threadtrue if lock acquired otherwise falseio.reactivex.Single<Boolean> tryLock(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 falseio.reactivex.Single<Boolean> tryLock(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 falseio.reactivex.Single<Boolean> tryLock(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 falseio.reactivex.Single<Integer> getHoldCount()
0 if this lock is not held by current threadio.reactivex.Single<Boolean> isLocked()
true if locked otherwise falseio.reactivex.Single<Long> remainTimeToLive()
Copyright © 2014–2019 Redisson. All rights reserved.