Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Alpha2J committed Sep 28, 2023
1 parent 64b3aa3 commit 7557ad3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private void startRetryLockThread() {
while (retryLockThread == null || retryLockThread.getState() == Thread.State.TERMINATED) {
if (retryLockThreadReference.compareAndSet(retryLockThread, new RemotingRetryLockThread(lockContext))) {
retryLockThread = retryLockThreadReference.get();
// one process have only one running retryLockThread
// one process have only one running retryLockThread
retryLockThread.start();
}
}
Expand Down Expand Up @@ -72,7 +72,7 @@ public void afterLocked(LockContext lockContext) {

@Override
public void beforeParking(LockContext lockContext) {
// if current process not holding the lock, then we should start the retry lock thread
// if current process not holding the lock, then we should start the retry lock thread
if (lockContext.holdingThread().get() == null) {
startRetryLockThread();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public boolean doLease(LockContext lockContext) {
Object leaseResult = null;
try {
LockState<?> lockState = lockContext.holdingLockState().get();
// if success, value will be "1"
// if success, value will be "1"
leaseResult = jedis.eval(leaseScript, Collections.singletonList(lockState.getIdentifier()), Arrays.asList((String) lockState.getValue(), lockContext.options().getLeaseMilliseconds() + ""));
} catch (Exception ignored) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ private void doRetry() throws InterruptedException {
RedisLockHandler lockHandler = (RedisLockHandler) lockContext.lockHandler();
boolean isStateExists = lockHandler.checkStateExists(lockContext.target());
if (!isStateExists) {
// lock hold by other process has been released,
// then we unpark queued head thread in current process
// lock hold by other process has been released,
// then we unpark queued head thread in current process
ReentrantDistributedLock lock = (ReentrantDistributedLock) lockContext.currentLock();
lock.unparkQueueHead();
}
Expand Down

0 comments on commit 7557ad3

Please sign in to comment.