From 7557ad3ef1e1e5b00f1571218dbe678e88972f29 Mon Sep 17 00:00:00 2001 From: "Jeb.Wang" Date: Thu, 28 Sep 2023 14:58:41 +0800 Subject: [PATCH] update --- .../hellooo/distributedlock/impl/redis/RedisLockCallback.java | 4 ++-- .../hellooo/distributedlock/impl/redis/RedisLockHandler.java | 2 +- .../distributedlock/impl/redis/RemotingRetryLockThread.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/site/hellooo/distributedlock/impl/redis/RedisLockCallback.java b/src/main/java/site/hellooo/distributedlock/impl/redis/RedisLockCallback.java index e5b3527..59b18dd 100644 --- a/src/main/java/site/hellooo/distributedlock/impl/redis/RedisLockCallback.java +++ b/src/main/java/site/hellooo/distributedlock/impl/redis/RedisLockCallback.java @@ -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(); } } @@ -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(); } diff --git a/src/main/java/site/hellooo/distributedlock/impl/redis/RedisLockHandler.java b/src/main/java/site/hellooo/distributedlock/impl/redis/RedisLockHandler.java index 6b90a19..599becb 100644 --- a/src/main/java/site/hellooo/distributedlock/impl/redis/RedisLockHandler.java +++ b/src/main/java/site/hellooo/distributedlock/impl/redis/RedisLockHandler.java @@ -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) { diff --git a/src/main/java/site/hellooo/distributedlock/impl/redis/RemotingRetryLockThread.java b/src/main/java/site/hellooo/distributedlock/impl/redis/RemotingRetryLockThread.java index aae6c04..3969b32 100644 --- a/src/main/java/site/hellooo/distributedlock/impl/redis/RemotingRetryLockThread.java +++ b/src/main/java/site/hellooo/distributedlock/impl/redis/RemotingRetryLockThread.java @@ -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(); }