Package org.redisson.api
Interface RLockReactive
-
public interface RLockReactive
Reactive interface for Lock object- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description reactor.core.publisher.Mono<>
forceUnlock()
Unlocks the lock independently of its statereactor.core.publisher.Mono<>
getHoldCount()
Number of holds on this lock by the current threadgetName()
Returns name of objectreactor.core.publisher.Mono<>
isLocked()
Checks if the lock locked by any threadreactor.core.publisher.Mono<>
lock()
Acquires the lock.reactor.core.publisher.Mono<>
lock(long threadId)
Acquires the lock by thread with definedthreadId
.reactor.core.publisher.Mono<>
lock(long leaseTime, unit)
Acquires the lock with definedleaseTime
.reactor.core.publisher.Mono<>
lock(long leaseTime, unit, long threadId)
Acquires the lock with definedleaseTime
andthreadId
.reactor.core.publisher.Mono<>
remainTimeToLive()
Remaining time to live of the lockreactor.core.publisher.Mono<>
tryLock()
Tries to acquire the lock.reactor.core.publisher.Mono<>
tryLock(long threadId)
Tries to acquire the lock by thread with specifiedthreadId
.reactor.core.publisher.Mono<>
tryLock(long waitTime, long leaseTime, unit)
Tries to acquire the lock with definedleaseTime
.reactor.core.publisher.Mono<>
tryLock(long waitTime, long leaseTime, unit, long threadId)
Tries to acquire the lock by thread with specifiedthreadId
andleaseTime
.reactor.core.publisher.Mono<>
tryLock(long waitTime, unit)
Tries to acquire the lock.reactor.core.publisher.Mono<>
unlock()
Unlocks the lockreactor.core.publisher.Mono<>
unlock(long threadId)
Unlocks the lock.
-
-
-
Method Detail
-
getName
getName()
Returns name of object- Returns:
- name - name of object
-
forceUnlock
reactor.core.publisher.Mono<> forceUnlock()
Unlocks the lock independently of its state- Returns:
true
if lock existed and now unlocked otherwisefalse
-
unlock
reactor.core.publisher.Mono<> unlock()
Unlocks the lock- Returns:
- void
-
unlock
reactor.core.publisher.Mono<> unlock(long threadId)
Unlocks the lock. Throws if lock isn't locked by thread with specifiedthreadId
.- Parameters:
threadId
- id of thread- Returns:
- void
-
tryLock
reactor.core.publisher.Mono<> tryLock()
Tries to acquire the lock.- Returns:
true
if lock acquired otherwisefalse
-
lock
reactor.core.publisher.Mono<> lock()
Acquires the lock. Waits if necessary until lock became available.- Returns:
- void
-
lock
reactor.core.publisher.Mono<> lock(long threadId)
Acquires the lock by thread with definedthreadId
. Waits if necessary until lock became available.- Parameters:
threadId
- id of thread- Returns:
- void
-
lock
reactor.core.publisher.Mono<> lock(long leaseTime, unit)
Acquires the lock with definedleaseTime
. Waits if necessary until lock became available. Lock will be released automatically after definedleaseTime
interval.- 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
-
lock
reactor.core.publisher.Mono<> lock(long leaseTime, unit, long threadId)
Acquires the lock with definedleaseTime
andthreadId
. Waits if necessary until lock became available. Lock will be released automatically after definedleaseTime
interval.- 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
-
tryLock
reactor.core.publisher.Mono<> tryLock(long threadId)
Tries to acquire the lock by thread with specifiedthreadId
.- Parameters:
threadId
- id of thread- Returns:
true
if lock acquired otherwisefalse
-
tryLock
reactor.core.publisher.Mono<> tryLock(long waitTime, unit)
Tries to acquire the lock. Waits up to definedwaitTime
if necessary until the lock became available.- Parameters:
waitTime
- the maximum time to acquire the lockunit
- time unit- Returns:
true
if lock is successfully acquired, otherwisefalse
if lock is already set.
-
tryLock
reactor.core.publisher.Mono<> tryLock(long waitTime, long leaseTime, unit)
Tries to acquire the lock with definedleaseTime
. Waits up to definedwaitTime
if necessary until the lock became available. Lock will be released automatically after definedleaseTime
interval.- Parameters:
waitTime
- the maximum time to acquire the lockleaseTime
- lease timeunit
- time unit- Returns:
true
if lock is successfully acquired, otherwisefalse
if lock is already set.
-
tryLock
reactor.core.publisher.Mono<> tryLock(long waitTime, long leaseTime, unit, long threadId)
Tries to acquire the lock by thread with specifiedthreadId
andleaseTime
. Waits up to definedwaitTime
if necessary until the lock became available. Lock will be released automatically after definedleaseTime
interval.- Parameters:
threadId
- id of threadwaitTime
- time interval to acquire lockleaseTime
- time interval after which lock will be released automaticallyunit
- the time unit of thewaitTime
andleaseTime
arguments- Returns:
true
if lock acquired otherwisefalse
-
getHoldCount
reactor.core.publisher.Mono<> getHoldCount()
Number of holds on this lock by the current thread- Returns:
- holds or
0
if this lock is not held by current thread
-
isLocked
reactor.core.publisher.Mono<> isLocked()
Checks if the lock locked by any thread- Returns:
true
if locked otherwisefalse
-
remainTimeToLive
reactor.core.publisher.Mono<> remainTimeToLive()
Remaining time to live of the lock- Returns:
- time in milliseconds -2 if the lock does not exist. -1 if the lock exists but has no associated expire.
-
-