public abstract class AbsLockDecorator extends Object implements IRedisLock, ILockWritable
| 限定符和类型 | 字段和说明 |
|---|---|
protected IRedisLock |
delegate
处理实例
|
static int |
ORDER_DEFAULT
默认的序号
|
DEFAULT_LOCK_SECONDS, DEFAULT_SLEEP_MAX_MILLS, DEFAULT_SLEEP_MIN_MILLS, DEFAULT_SPIN_TIME| 构造器和说明 |
|---|
AbsLockDecorator(IRedisLock delegate)
构造一个 包装器实例
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
debugMessage(String message)
来一个 debug 消息
|
protected void |
errorMessage(String message)
来一个 error 消息
|
<T extends AbsLockDecorator> |
getDecoratorByClass(Class<T> clazz)
获取特定 class 类型的装饰者实例
|
String |
getKey()
获取锁的key
|
RedisLockClient |
getLockClient()
获取 锁的客户端
|
int |
getLockSeconds()
需要锁定的时间
|
protected abstract org.slf4j.Logger |
getLogger()
获取 logger 对象
|
RedisLockReleaseStatus |
getReleaseStatus()
获取 释放 状态
|
int |
getSleepMaxMills()
获取最大休眠时间
|
int |
getSleepMinMills()
获取最小休眠时间,毫秒
|
int |
getSpinTimes()
获取自旋次数
|
RedisLockStatus |
getStatus()
获取所的状态
|
protected void |
infoMessage(String message)
来一个 info 消息
|
boolean |
interrupted()
取消当前锁,只对 NEW 状态可用
|
boolean |
isFinished()
流程结束
|
boolean |
needUnlock()
是否需要解锁
|
void |
setKey(String key)
设置 key
|
void |
setLockSeconds(int lockSeconds)
设置 锁定时间,单位秒
|
void |
setReleaseStatus(RedisLockReleaseStatus releaseStatus)
设置 release 状态
|
void |
setSleepMaxMills(int sleepMaxMills)
设置 休眠最大时间,单位毫秒
|
void |
setSleepMinMills(int sleepMinMills)
设置 休眠最小时间,单位毫秒
|
void |
setSpinTimes(int spinTimes)
设置 自旋次数
|
void |
setStatus(RedisLockStatus status)
设置 状态
|
boolean |
tryLock() |
boolean |
tryLock(long time,
TimeUnit unit) |
void |
unlock() |
void |
unlocked(boolean release)
成功并设置状态
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, execute, isLocked, isRollback, lock, lockInterruptibly, newConditionexecute, execute, execute, execute, executegetSleepMills, inStates, isStatusprotected IRedisLock delegate
public static final int ORDER_DEFAULT
public AbsLockDecorator(IRedisLock delegate)
delegate - 实际执行者public void setStatus(RedisLockStatus status)
setStatus 在接口中 ILockWritablestatus - public RedisLockStatus getStatus()
ILockgetStatus 在接口中 ILockgetStatus 在接口中 ILockWritablepublic void setKey(String key)
ILockWritablesetKey 在接口中 ILockWritablekey - 要设置的keypublic int getLockSeconds()
ILockgetLockSeconds 在接口中 ILockgetLockSeconds 在接口中 ILockWritablepublic boolean needUnlock()
ILockWritableneedUnlock 在接口中 ILockWritablepublic boolean isFinished()
ILockisFinished 在接口中 ILockpublic boolean interrupted()
ILockinterrupted 在接口中 ILockpublic final <T extends AbsLockDecorator> T getDecoratorByClass(Class<T> clazz)
T - 类型clazz - 类名protected abstract org.slf4j.Logger getLogger()
protected void debugMessage(String message)
message - 消息protected void infoMessage(String message)
message - 消息protected void errorMessage(String message)
message - 消息public void setLockSeconds(int lockSeconds)
ILockWritablesetLockSeconds 在接口中 ILockWritablelockSeconds - 要设置的锁定时长public void unlocked(boolean release)
ILockWritableunlocked 在接口中 ILockWritablerelease - 是否释放成功public RedisLockReleaseStatus getReleaseStatus()
ILockgetReleaseStatus 在接口中 ILockpublic void setReleaseStatus(RedisLockReleaseStatus releaseStatus)
ILockWritablesetReleaseStatus 在接口中 ILockWritablereleaseStatus - 释放状态public void setSleepMinMills(int sleepMinMills)
ILockWritablesetSleepMinMills 在接口中 ILockWritablesleepMinMills - 最小休眠时间public int getSleepMinMills()
ILockgetSleepMinMills 在接口中 ILockgetSleepMinMills 在接口中 ILockWritablepublic void setSleepMaxMills(int sleepMaxMills)
ILockWritablesetSleepMaxMills 在接口中 ILockWritablepublic int getSleepMaxMills()
ILockgetSleepMaxMills 在接口中 ILockgetSleepMaxMills 在接口中 ILockWritablepublic void setSpinTimes(int spinTimes)
ILockWritablesetSpinTimes 在接口中 ILockWritablepublic int getSpinTimes()
ILockgetSpinTimes 在接口中 ILockgetSpinTimes 在接口中 ILockWritablepublic boolean tryLock(long time,
TimeUnit unit)
throws InterruptedException
tryLock 在接口中 LockInterruptedExceptionpublic RedisLockClient getLockClient()
ILockWritablegetLockClient 在接口中 ILockWritableCopyright © 2020. All rights reserved.