public abstract class RedissonBaseLock extends RedissonObject implements RLock
Modifier and Type | Class and Description |
---|---|
static class |
RedissonBaseLock.ExpirationEntry |
Modifier and Type | Field and Description |
---|---|
protected long |
internalLockLeaseTime |
codec, name
Constructor and Description |
---|
RedissonBaseLock(CommandAsyncExecutor commandExecutor,
String name) |
Modifier and Type | Method and Description |
---|---|
protected void |
acquireFailed(long waitTime,
TimeUnit unit,
long threadId) |
protected RFuture<Void> |
acquireFailedAsync(long waitTime,
TimeUnit unit,
long threadId) |
protected void |
cancelExpirationRenewal(Long threadId) |
boolean |
clearExpire()
Clear an expire timeout or expire date for object.
|
RFuture<Boolean> |
clearExpireAsync()
Clear an expire timeout or expire date for object in async mode.
|
protected RFuture<Boolean> |
clearExpireAsync(String... keys) |
RFuture<Boolean> |
deleteAsync()
Delete object in async mode
|
protected <T> RFuture<T> |
evalWriteAsync(String key,
Codec codec,
RedisCommand<T> evalCommandType,
String script,
List<Object> keys,
Object... params) |
boolean |
expire(long timeToLive,
TimeUnit timeUnit)
Set a timeout for object.
|
RFuture<Boolean> |
expireAsync(long timeToLive,
TimeUnit timeUnit)
Set a timeout for object in async mode.
|
protected RFuture<Boolean> |
expireAsync(long timeToLive,
TimeUnit timeUnit,
String... keys) |
boolean |
expireAt(Date timestamp)
Set an expire date for object.
|
boolean |
expireAt(long timestamp)
Set an expire date for object.
|
RFuture<Boolean> |
expireAtAsync(Date timestamp)
Set an expire date for object in async mode.
|
RFuture<Boolean> |
expireAtAsync(long timestamp)
Set an expire date for object in async mode.
|
protected RFuture<Boolean> |
expireAtAsync(long timestamp,
String... keys) |
protected String |
getEntryName() |
int |
getHoldCount()
Number of holds on this lock by the current thread
|
RFuture<Integer> |
getHoldCountAsync()
Number of holds on this lock by the current thread
|
protected String |
getLockName(long threadId) |
RFuture<Boolean> |
isExistsAsync()
Check object existence in async mode.
|
boolean |
isHeldByCurrentThread()
Checks if this lock is held by the current thread
|
boolean |
isHeldByThread(long threadId)
Checks if the lock is held by thread with defined
threadId |
boolean |
isLocked()
Checks if the lock locked by any thread
|
RFuture<Boolean> |
isLockedAsync()
Checks if the lock locked by any thread
|
Condition |
newCondition() |
long |
remainTimeToLive()
Remaining time to live of Redisson object that has a timeout
|
RFuture<Long> |
remainTimeToLiveAsync()
Remaining time to live of Redisson object that has a timeout
|
protected RFuture<Boolean> |
renewExpirationAsync(long threadId) |
protected void |
scheduleExpirationRenewal(long threadId) |
RFuture<Void> |
unlockAsync()
Unlocks the lock
|
RFuture<Void> |
unlockAsync(long threadId)
Unlocks the lock.
|
protected abstract RFuture<Boolean> |
unlockInnerAsync(long threadId) |
addListener, addListener, addListenerAsync, addListenerAsync, copy, copyAsync, delete, deleteAsync, dump, dumpAsync, encode, encode, encode, encode, encodeMapKey, encodeMapKeys, encodeMapValue, encodeMapValues, get, getCodec, getIdleTime, getIdleTimeAsync, getLockByMapKey, getLockByValue, getName, getName, isExists, migrate, migrateAsync, move, moveAsync, prefixName, removeListener, removeListenerAsync, removeListenersAsync, rename, renameAsync, renamenx, renamenxAsync, restore, restore, restoreAndReplace, restoreAndReplace, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, setName, sizeInMemory, sizeInMemoryAsync, sizeInMemoryAsync, sizeInMemoryAsync, suffixName, toSeconds, toStream, touch, touchAsync, unlink, unlinkAsync
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forceUnlock, getName, lock, lockInterruptibly, remainTimeToLive, tryLock
lock, lockInterruptibly, tryLock, tryLock, unlock
forceUnlockAsync, lockAsync, lockAsync, lockAsync, lockAsync, remainTimeToLiveAsync, tryLockAsync, tryLockAsync, tryLockAsync, tryLockAsync, tryLockAsync
addListener, copy, delete, dump, getCodec, getIdleTime, getName, isExists, migrate, move, removeListener, rename, renamenx, restore, restore, restoreAndReplace, restoreAndReplace, sizeInMemory, touch, unlink
addListenerAsync, copyAsync, dumpAsync, getIdleTimeAsync, migrateAsync, moveAsync, removeListenerAsync, renameAsync, renamenxAsync, restoreAndReplaceAsync, restoreAndReplaceAsync, restoreAsync, restoreAsync, sizeInMemoryAsync, touchAsync, unlinkAsync
public RedissonBaseLock(CommandAsyncExecutor commandExecutor, String name)
protected String getEntryName()
protected String getLockName(long threadId)
protected void scheduleExpirationRenewal(long threadId)
protected void cancelExpirationRenewal(Long threadId)
protected <T> RFuture<T> evalWriteAsync(String key, Codec codec, RedisCommand<T> evalCommandType, String script, List<Object> keys, Object... params)
protected void acquireFailed(long waitTime, TimeUnit unit, long threadId)
protected RFuture<Void> acquireFailedAsync(long waitTime, TimeUnit unit, long threadId)
public Condition newCondition()
newCondition
in interface Lock
public boolean isLocked()
RLock
public RFuture<Boolean> isLockedAsync()
RLockAsync
isLockedAsync
in interface RLockAsync
true
if locked otherwise false
public RFuture<Boolean> isExistsAsync()
RObjectAsync
isExistsAsync
in interface RObjectAsync
isExistsAsync
in class RedissonObject
true
if object exists and false
otherwisepublic boolean isHeldByCurrentThread()
RLock
isHeldByCurrentThread
in interface RLock
true
if held by current thread
otherwise false
public boolean isHeldByThread(long threadId)
RLock
threadId
isHeldByThread
in interface RLock
threadId
- Thread ID of locking threadtrue
if held by thread with given id
otherwise false
public RFuture<Integer> getHoldCountAsync()
RLockAsync
getHoldCountAsync
in interface RLockAsync
0
if this lock is not held by current threadpublic int getHoldCount()
RLock
getHoldCount
in interface RLock
0
if this lock is not held by current threadpublic RFuture<Boolean> deleteAsync()
RObjectAsync
deleteAsync
in interface RObjectAsync
deleteAsync
in class RedissonObject
true
if object was deleted false
if notpublic RFuture<Void> unlockAsync()
RLockAsync
unlockAsync
in interface RLockAsync
public RFuture<Void> unlockAsync(long threadId)
RLockAsync
IllegalMonitorStateException
if lock isn't locked by thread with specified threadId
.unlockAsync
in interface RLockAsync
threadId
- id of threadpublic boolean expire(long timeToLive, TimeUnit timeUnit)
RExpirable
expire
in interface RExpirable
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unittrue
if the timeout was set and false
if notpublic RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit)
RExpirableAsync
expireAsync
in interface RExpirableAsync
timeToLive
- - timeout before object will be deletedtimeUnit
- - timeout time unittrue
if the timeout was set and false
if notpublic boolean expireAt(long timestamp)
RExpirable
expireAt
in interface RExpirable
timestamp
- - expire date in milliseconds (Unix timestamp)true
if the timeout was set and false
if notpublic RFuture<Boolean> expireAtAsync(long timestamp)
RExpirableAsync
expireAtAsync
in interface RExpirableAsync
timestamp
- - expire date in milliseconds (Unix timestamp)true
if the timeout was set and false
if notpublic boolean expireAt(Date timestamp)
RExpirable
expireAt
in interface RExpirable
timestamp
- - expire datetrue
if the timeout was set and false
if notpublic RFuture<Boolean> expireAtAsync(Date timestamp)
RExpirableAsync
expireAtAsync
in interface RExpirableAsync
timestamp
- - expire datetrue
if the timeout was set and false
if notpublic boolean clearExpire()
RExpirable
clearExpire
in interface RExpirable
true
if timeout was removed
false
if object does not exist or does not have an associated timeoutpublic RFuture<Boolean> clearExpireAsync()
RExpirableAsync
clearExpireAsync
in interface RExpirableAsync
true
if the timeout was cleared and false
if notpublic long remainTimeToLive()
RExpirable
remainTimeToLive
in interface RExpirable
public RFuture<Long> remainTimeToLiveAsync()
RExpirableAsync
remainTimeToLiveAsync
in interface RExpirableAsync
protected RFuture<Boolean> expireAsync(long timeToLive, TimeUnit timeUnit, String... keys)
Copyright © 2014–2021 Redisson. All rights reserved.