You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2024/12/22 03:59:23 UTC

(shardingsphere) branch master updated: Refactor ClusterLockContext (#34118)

This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new e65efa34577 Refactor ClusterLockContext (#34118)
e65efa34577 is described below

commit e65efa3457769afe163cb96aff745d807f83f679
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sun Dec 22 11:59:16 2024 +0800

    Refactor ClusterLockContext (#34118)
---
 .../mode/manager/cluster/lock/ClusterLockContext.java       | 13 +++++++------
 .../mode/manager/standalone/lock/StandaloneLockContext.java |  2 +-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/lock/ClusterLockContext.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/lock/ClusterLockContext.java
index 533642f862d..10e978989b8 100644
--- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/lock/ClusterLockContext.java
+++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/lock/ClusterLockContext.java
@@ -19,24 +19,25 @@ package org.apache.shardingsphere.mode.manager.cluster.lock;
 
 import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.infra.lock.LockContext;
+import org.apache.shardingsphere.infra.lock.LockDefinition;
 import org.apache.shardingsphere.mode.lock.LockPersistService;
 import org.apache.shardingsphere.mode.lock.global.GlobalLockDefinition;
 
 /**
- * Cluster global lock context.
+ * Cluster lock context.
  */
 @RequiredArgsConstructor
-public final class ClusterLockContext implements LockContext<GlobalLockDefinition> {
+public final class ClusterLockContext implements LockContext<LockDefinition> {
     
     private final LockPersistService<GlobalLockDefinition> globalLockPersistService;
     
     @Override
-    public boolean tryLock(final GlobalLockDefinition lockDefinition, final long timeoutMillis) {
-        return globalLockPersistService.tryLock(lockDefinition, timeoutMillis);
+    public boolean tryLock(final LockDefinition lockDefinition, final long timeoutMillis) {
+        return globalLockPersistService.tryLock((GlobalLockDefinition) lockDefinition, timeoutMillis);
     }
     
     @Override
-    public void unlock(final GlobalLockDefinition lockDefinition) {
-        globalLockPersistService.unlock(lockDefinition);
+    public void unlock(final LockDefinition lockDefinition) {
+        globalLockPersistService.unlock((GlobalLockDefinition) lockDefinition);
     }
 }
diff --git a/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/lock/StandaloneLockContext.java b/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/lock/StandaloneLockContext.java
index f790342744e..6b5e5a603df 100644
--- a/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/lock/StandaloneLockContext.java
+++ b/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/lock/StandaloneLockContext.java
@@ -21,7 +21,7 @@ import org.apache.shardingsphere.infra.lock.LockContext;
 import org.apache.shardingsphere.infra.lock.LockDefinition;
 
 /**
- * Standalone global lock context.
+ * Standalone lock context.
  */
 public final class StandaloneLockContext implements LockContext<LockDefinition> {