Class DistributedLockHandler
java.lang.Object
com.aizuda.snailjob.server.job.task.support.handler.DistributedLockHandler
分布式锁工具类
- Since:
- : 2.6.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidlockWithDisposable(LockExecutor lockExecutor, String lockName, Duration lockAtMost) 获取分布式锁voidlockWithDisposableAndRetry(LockExecutor lockExecutor, String lockName, Duration lockAtMost, Duration sleepTime, Integer maxRetryTimes) 获取分布式锁并支持重试
-
Constructor Details
-
DistributedLockHandler
public DistributedLockHandler()
-
-
Method Details
-
lockWithDisposableAndRetry
public void lockWithDisposableAndRetry(LockExecutor lockExecutor, String lockName, Duration lockAtMost, Duration sleepTime, Integer maxRetryTimes) 获取分布式锁并支持重试- Parameters:
lockExecutor- 执行器lockName- 锁名称lockAtMost- 锁超时时间sleepTime- 重试间隔maxRetryTimes- 重试次数
-
lockWithDisposable
获取分布式锁- Parameters:
lockExecutor- 执行器lockName- 锁名称lockAtMost- 锁超时时间
-