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 2022/06/30 06:44:09 UTC

[shardingsphere] branch master updated: Rename mutex lock to internal lock (#18723)

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

zhaojinchao 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 a6bf7d86e9b Rename mutex lock to internal lock (#18723)
a6bf7d86e9b is described below

commit a6bf7d86e9bb03c60822285512ebe2aa06d9f1b9
Author: gin <ja...@163.com>
AuthorDate: Thu Jun 30 14:44:00 2022 +0800

    Rename mutex lock to internal lock (#18723)
---
 .../coordinator/lock/DistributedLockContext.java   |  6 +--
 .../ShardingSphereDistributedDatabaseLock.java     | 20 ++++-----
 .../distributed/ShardingSphereDistributedLock.java | 18 ++++----
 .../ShardingSphereDistributedLockManager.java      |  4 +-
 .../lock/manager/ShardingSphereLockManager.java    |  4 +-
 .../internal/ExclusiveInternalLock.java}           | 24 +++++------
 .../internal/InternalLock.java}                    |  7 ++-
 .../{mutex => manager/internal}/LockAckAble.java   |  5 ++-
 .../internal/ReentrantInternalLock.java}           |  4 +-
 .../ShardingSphereInternalLockHolder.java}         | 50 +++++++++++-----------
 10 files changed, 74 insertions(+), 68 deletions(-)

diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/DistributedLockContext.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/DistributedLockContext.java
index 4ba58e75e05..03f8c8c0f1e 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/DistributedLockContext.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/DistributedLockContext.java
@@ -21,7 +21,7 @@ import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.infra.instance.InstanceContext;
 import org.apache.shardingsphere.infra.lock.ShardingSphereLock;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.manager.ShardingSphereLockManager;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.mutex.ShardingSphereInterMutexLockHolder;
+import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.manager.internal.ShardingSphereInternalLockHolder;
 import org.apache.shardingsphere.mode.manager.lock.AbstractLockContext;
 import org.apache.shardingsphere.mode.manager.lock.definition.DatabaseLockNameDefinition;
 import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
@@ -44,10 +44,10 @@ public final class DistributedLockContext extends AbstractLockContext {
     
     @Override
     public void initLockState(final InstanceContext instanceContext) {
-        loadLockManager(new ShardingSphereInterMutexLockHolder(repository, instanceContext.getInstance(), instanceContext.getComputeNodeInstances()));
+        loadLockManager(new ShardingSphereInternalLockHolder(repository, instanceContext.getInstance(), instanceContext.getComputeNodeInstances()));
     }
     
-    private void loadLockManager(final ShardingSphereInterMutexLockHolder lockHolder) {
+    private void loadLockManager(final ShardingSphereInternalLockHolder lockHolder) {
         lockManager = RequiredSPIRegistry.getRegisteredService(ShardingSphereLockManager.class);
         lockManager.init(lockHolder);
     }
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/database/ShardingSphereDistributedDatabaseLock.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/database/ShardingSphereDistributedDatabaseLock.java
index a7d70f1edac..4de03a2774a 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/database/ShardingSphereDistributedDatabaseLock.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/database/ShardingSphereDistributedDatabaseLock.java
@@ -27,8 +27,8 @@ import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.database.
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.database.event.DatabaseAckLockedEvent;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.database.event.DatabaseLockReleasedEvent;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.database.event.DatabaseLockedEvent;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.mutex.InterMutexLock;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.mutex.ShardingSphereInterMutexLockHolder;
+import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.manager.internal.ExclusiveInternalLock;
+import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.manager.internal.ShardingSphereInternalLockHolder;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.util.LockNodeType;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.util.TimeoutMilliseconds;
 
@@ -41,11 +41,11 @@ public final class ShardingSphereDistributedDatabaseLock implements ShardingSphe
     
     private final LockNodeService lockNodeService = LockNodeServiceFactory.getInstance().getLockNodeService(LockNodeType.DATABASE);
     
-    private final ShardingSphereInterMutexLockHolder lockHolder;
+    private final ShardingSphereInternalLockHolder lockHolder;
     
     private final LockStateContext lockStateContext;
     
-    public ShardingSphereDistributedDatabaseLock(final ShardingSphereInterMutexLockHolder lockHolder, final LockStateContext lockStateContext) {
+    public ShardingSphereDistributedDatabaseLock(final ShardingSphereInternalLockHolder lockHolder, final LockStateContext lockStateContext) {
         this.lockHolder = lockHolder;
         this.lockStateContext = lockStateContext;
         ShardingSphereEventBus.getInstance().register(this);
@@ -70,13 +70,13 @@ public final class ShardingSphereDistributedDatabaseLock implements ShardingSphe
         return false;
     }
     
-    private Optional<InterMutexLock> getInterMutexLock(final String lockName) {
+    private Optional<ExclusiveInternalLock> getInterMutexLock(final String lockName) {
         return lockHolder.getInterMutexLock(lockNodeService.generateLocksName(lockName));
     }
     
     @Override
     public void releaseLock(final String lockName) {
-        Optional<InterMutexLock> interMutexLock = getInterMutexLock(lockName);
+        Optional<ExclusiveInternalLock> interMutexLock = getInterMutexLock(lockName);
         if (interMutexLock.isPresent()) {
             interMutexLock.get().unlock();
             lockStateContext.unregister(lockName);
@@ -85,7 +85,7 @@ public final class ShardingSphereDistributedDatabaseLock implements ShardingSphe
     
     @Override
     public boolean isLocked(final String lockName) {
-        return getInterMutexLock(lockName).map(InterMutexLock::isLocked).orElse(false);
+        return getInterMutexLock(lockName).map(ExclusiveInternalLock::isLocked).orElse(false);
     }
     
     /**
@@ -97,8 +97,8 @@ public final class ShardingSphereDistributedDatabaseLock implements ShardingSphe
     public synchronized void locked(final DatabaseLockedEvent event) {
         String database = event.getDatabase();
         String lockedInstanceId = lockHolder.getCurrentInstanceId();
-        InterMutexLock interMutexLock = lockHolder.getOrCreateInterMutexLock(lockNodeService.generateLocksName(database));
-        interMutexLock.ackLock(lockNodeService.generateAckLockName(database, lockedInstanceId), lockedInstanceId);
+        ExclusiveInternalLock exclusiveLock = lockHolder.getOrCreateInterMutexLock(lockNodeService.generateLocksName(database));
+        exclusiveLock.ackLock(lockNodeService.generateAckLockName(database, lockedInstanceId), lockedInstanceId);
         lockStateContext.register(database);
     }
     
@@ -111,7 +111,7 @@ public final class ShardingSphereDistributedDatabaseLock implements ShardingSphe
     public synchronized void lockReleased(final DatabaseLockReleasedEvent event) {
         String database = event.getDatabase();
         String lockedInstanceId = lockHolder.getCurrentInstanceId();
-        Optional<InterMutexLock> interMutexLock = getInterMutexLock(database);
+        Optional<ExclusiveInternalLock> interMutexLock = getInterMutexLock(database);
         if (interMutexLock.isPresent()) {
             interMutexLock.get().releaseAckLock(lockNodeService.generateAckLockName(database, lockedInstanceId), lockedInstanceId);
             lockStateContext.unregister(database);
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/distributed/ShardingSphereDistributedLock.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/distributed/ShardingSphereDistributedLock.java
index 02fed75e65c..30baa863438 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/distributed/ShardingSphereDistributedLock.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/distributed/ShardingSphereDistributedLock.java
@@ -23,8 +23,8 @@ import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
 import org.apache.shardingsphere.infra.lock.ShardingSphereLock;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.LockNodeService;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.service.LockNodeServiceFactory;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.mutex.InterMutexLock;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.mutex.ShardingSphereInterMutexLockHolder;
+import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.manager.internal.ExclusiveInternalLock;
+import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.manager.internal.ShardingSphereInternalLockHolder;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.distributed.event.DistributedAckLockReleasedEvent;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.distributed.event.DistributedAckLockedEvent;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.distributed.event.DistributedLockReleasedEvent;
@@ -42,9 +42,9 @@ public final class ShardingSphereDistributedLock implements ShardingSphereLock {
     
     private final LockNodeService lockNodeService = LockNodeServiceFactory.getInstance().getLockNodeService(LockNodeType.DISTRIBUTED);
     
-    private final ShardingSphereInterMutexLockHolder lockHolder;
+    private final ShardingSphereInternalLockHolder lockHolder;
     
-    public ShardingSphereDistributedLock(final ShardingSphereInterMutexLockHolder lockHolder) {
+    public ShardingSphereDistributedLock(final ShardingSphereInternalLockHolder lockHolder) {
         this.lockHolder = lockHolder;
         ShardingSphereEventBus.getInstance().register(this);
         syncDistributedLockStatus();
@@ -68,18 +68,18 @@ public final class ShardingSphereDistributedLock implements ShardingSphereLock {
         return lockHolder.getOrCreateInterMutexLock(lockNodeService.generateLocksName(lockName)).tryLock(timeoutMillis);
     }
     
-    private Optional<InterMutexLock> getInterMutexLock(final String lockName) {
+    private Optional<ExclusiveInternalLock> getInterMutexLock(final String lockName) {
         return lockHolder.getInterMutexLock(lockNodeService.generateLocksName(lockName));
     }
     
     @Override
     public void releaseLock(final String lockName) {
-        getInterMutexLock(lockName).ifPresent(InterMutexLock::unlock);
+        getInterMutexLock(lockName).ifPresent(ExclusiveInternalLock::unlock);
     }
     
     @Override
     public boolean isLocked(final String lockName) {
-        return getInterMutexLock(lockName).map(InterMutexLock::isLocked).orElse(false);
+        return getInterMutexLock(lockName).map(ExclusiveInternalLock::isLocked).orElse(false);
     }
     
     /**
@@ -91,8 +91,8 @@ public final class ShardingSphereDistributedLock implements ShardingSphereLock {
     public synchronized void locked(final DistributedLockedEvent event) {
         String lockName = event.getLockedName();
         String lockedInstanceId = lockHolder.getCurrentInstanceId();
-        InterMutexLock interMutexLock = lockHolder.getOrCreateInterMutexLock(lockNodeService.generateLocksName(lockName));
-        interMutexLock.ackLock(lockNodeService.generateAckLockName(lockName, lockedInstanceId), lockedInstanceId);
+        ExclusiveInternalLock exclusiveLock = lockHolder.getOrCreateInterMutexLock(lockNodeService.generateLocksName(lockName));
+        exclusiveLock.ackLock(lockNodeService.generateAckLockName(lockName, lockedInstanceId), lockedInstanceId);
     }
     
     /**
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/ShardingSphereDistributedLockManager.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/ShardingSphereDistributedLockManager.java
index 541ca5054ee..714214ade6c 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/ShardingSphereDistributedLockManager.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/ShardingSphereDistributedLockManager.java
@@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.lock.ShardingSphereLock;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.database.ShardingSphereDistributedDatabaseLock;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.distributed.ShardingSphereDistributedLock;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.manager.state.LockStateContextFactory;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.mutex.ShardingSphereInterMutexLockHolder;
+import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.manager.internal.ShardingSphereInternalLockHolder;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.util.TimeoutMilliseconds;
 import org.apache.shardingsphere.mode.manager.lock.definition.DatabaseLockNameDefinition;
 
@@ -39,7 +39,7 @@ public final class ShardingSphereDistributedLockManager implements ShardingSpher
     private ShardingSphereLock databaseLock;
     
     @Override
-    public void init(final ShardingSphereInterMutexLockHolder lockHolder) {
+    public void init(final ShardingSphereInternalLockHolder lockHolder) {
         distributedLock = new ShardingSphereDistributedLock(lockHolder);
         databaseLock = new ShardingSphereDistributedDatabaseLock(lockHolder, LockStateContextFactory.getLockStateContext());
     }
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/ShardingSphereLockManager.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/ShardingSphereLockManager.java
index 6c6fcf6140e..06c835b69cd 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/ShardingSphereLockManager.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/ShardingSphereLockManager.java
@@ -18,7 +18,7 @@
 package org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.manager;
 
 import org.apache.shardingsphere.infra.lock.ShardingSphereLock;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.mutex.ShardingSphereInterMutexLockHolder;
+import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.manager.internal.ShardingSphereInternalLockHolder;
 import org.apache.shardingsphere.mode.manager.lock.definition.DatabaseLockNameDefinition;
 import org.apache.shardingsphere.spi.annotation.SingletonSPI;
 import org.apache.shardingsphere.spi.type.required.RequiredSPI;
@@ -34,7 +34,7 @@ public interface ShardingSphereLockManager extends RequiredSPI {
      *
      * @param lockHolder lock holder
      */
-    void init(ShardingSphereInterMutexLockHolder lockHolder);
+    void init(ShardingSphereInternalLockHolder lockHolder);
     
     /**
      * Get distributed lock.
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/mutex/InterMutexLock.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/ExclusiveInternalLock.java
similarity index 88%
rename from shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/mutex/InterMutexLock.java
rename to shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/ExclusiveInternalLock.java
index 229fa30c561..643bf7c54be 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/mutex/InterMutexLock.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/ExclusiveInternalLock.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.mutex;
+package org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.manager.internal;
 
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -32,15 +32,15 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
 
 /**
- * Inter mutex lock.
+ * Exclusive lock.
  */
 @Slf4j
 @RequiredArgsConstructor
-public final class InterMutexLock implements MutexLock, LockAckAble {
+public final class ExclusiveInternalLock implements InternalLock, LockAckAble {
     
     private final String lockName;
     
-    private final MutexLock sequence;
+    private final InternalLock sequencedInternalLock;
     
     private final LockRegistryService lockService;
     
@@ -61,32 +61,32 @@ public final class InterMutexLock implements MutexLock, LockAckAble {
     
     @Override
     public boolean tryLock(final long timeoutMillis) {
-        if (!sequence.tryLock(TimeoutMilliseconds.DEFAULT_REGISTRY)) {
-            log.debug("Inter mutex sequence lock acquire sequenced failed, lock name: {}", lockName);
+        if (!sequencedInternalLock.tryLock(TimeoutMilliseconds.DEFAULT_REGISTRY)) {
+            log.debug("Exclusive lock acquire sequenced failed, lock name: {}", lockName);
             return false;
         }
         try {
             long timeoutMilliseconds = Math.max(timeoutMillis, TimeoutMilliseconds.MIN_TRY_LOCK);
-            log.debug("Inter mutex sequence lock acquire sequenced success, lock name: {}, timeout milliseconds: {}ms", lockName, timeoutMilliseconds);
+            log.debug("Exclusive lock acquire sequenced success, lock name: {}, timeout milliseconds: {}ms", lockName, timeoutMilliseconds);
             return innerTryLock(lockName, timeoutMilliseconds);
         } finally {
-            sequence.unlock();
-            log.debug("Inter mutex sequence lock release sequenced success, database name: {}", lockName);
+            sequencedInternalLock.unlock();
+            log.debug("Exclusive lock release sequenced success, database name: {}", lockName);
         }
     }
     
     private boolean innerTryLock(final String lockName, final long timeout) {
         if (!synchronizedLockState.compareAndSet(LockState.UNLOCKED, LockState.LOCKING)) {
-            log.debug("Inter mutex lock try Lock set lock state failed, lock name: {}, lock state: {}", lockName, synchronizedLockState.get().name());
+            log.debug("Exclusive lock try Lock set lock state failed, lock name: {}, lock state: {}", lockName, synchronizedLockState.get().name());
             return false;
         }
         if (!isOwner.compareAndSet(false, true)) {
-            log.debug("Inter mutex lock try Lock set lock owner failed, lock name: {}, lock is owner: {}", lockName, isOwner.get());
+            log.debug("Exclusive lock try Lock set lock owner failed, lock name: {}, lock is owner: {}", lockName, isOwner.get());
             return false;
         }
         if (acquire(lockName, timeout)) {
             if (synchronizedLockState.compareAndSet(LockState.LOCKING, LockState.LOCKED)) {
-                log.debug("Inter mutex lock try Lock acquire lock success, lock name: {}", lockName);
+                log.debug("Exclusive lock try Lock acquire lock success, lock name: {}", lockName);
                 return true;
             }
         }
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/mutex/MutexLock.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/InternalLock.java
similarity index 93%
rename from shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/mutex/MutexLock.java
rename to shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/InternalLock.java
index 16365825ba9..a03e5e039fd 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/mutex/MutexLock.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/InternalLock.java
@@ -15,9 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.mutex;
+package org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.manager.internal;
 
-public interface MutexLock {
+/**
+ * Internal lock.
+ */
+public interface InternalLock {
     
     /**
      * Try lock.
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/mutex/LockAckAble.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/LockAckAble.java
similarity index 96%
rename from shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/mutex/LockAckAble.java
rename to shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/LockAckAble.java
index 3cc4144939a..ee0ed43e42a 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/mutex/LockAckAble.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/LockAckAble.java
@@ -15,8 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.mutex;
+package org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.manager.internal;
 
+/**
+ * Lock ack able.
+ */
 public interface LockAckAble {
     
     /**
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/mutex/InterReentrantMutexLock.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/ReentrantInternalLock.java
similarity index 94%
rename from shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/mutex/InterReentrantMutexLock.java
rename to shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/ReentrantInternalLock.java
index 8c739d6c1a9..556b19d1306 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/mutex/InterReentrantMutexLock.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/ReentrantInternalLock.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.mutex;
+package org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.manager.internal;
 
 import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.util.TimeoutMilliseconds;
@@ -27,7 +27,7 @@ import java.util.concurrent.locks.Lock;
  * Inter mutex reentrant lock.
  */
 @RequiredArgsConstructor
-public final class InterReentrantMutexLock implements MutexLock {
+public final class ReentrantInternalLock implements InternalLock {
     
     private final Lock internalLock;
     
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/mutex/ShardingSphereInterMutexLockHolder.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/ShardingSphereInternalLockHolder.java
similarity index 66%
rename from shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/mutex/ShardingSphereInterMutexLockHolder.java
rename to shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/ShardingSphereInternalLockHolder.java
index a589aad21d0..6512a9284a8 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/mutex/ShardingSphereInterMutexLockHolder.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/ShardingSphereInternalLockHolder.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.mutex;
+package org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.manager.internal;
 
 import org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
 import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.LockNodeService;
@@ -31,11 +31,11 @@ import java.util.Map;
 import java.util.Optional;
 
 /**
- * Inter mutex lock holder of ShardingSphere.
+ * Lock holder of ShardingSphere.
  */
-public final class ShardingSphereInterMutexLockHolder {
+public final class ShardingSphereInternalLockHolder {
     
-    private final Map<String, MutexLock> mutexLocks = new LinkedHashMap<>();
+    private final Map<String, InternalLock> internalLocks = new LinkedHashMap<>();
     
     private final ClusterPersistRepository clusterRepository;
     
@@ -45,7 +45,7 @@ public final class ShardingSphereInterMutexLockHolder {
     
     private final LockRegistryService mutexLockRegistryService;
     
-    public ShardingSphereInterMutexLockHolder(final ClusterPersistRepository repository, final ComputeNodeInstance instance, final Collection<ComputeNodeInstance> nodeInstances) {
+    public ShardingSphereInternalLockHolder(final ClusterPersistRepository repository, final ComputeNodeInstance instance, final Collection<ComputeNodeInstance> nodeInstances) {
         clusterRepository = repository;
         currentInstance = instance;
         computeNodeInstances = nodeInstances;
@@ -58,22 +58,22 @@ public final class ShardingSphereInterMutexLockHolder {
      * @param locksName locks name
      * @return inter mutex lock
      */
-    public synchronized InterMutexLock getOrCreateInterMutexLock(final String locksName) {
-        MutexLock result = mutexLocks.get(locksName);
+    public synchronized ExclusiveInternalLock getOrCreateInterMutexLock(final String locksName) {
+        InternalLock result = internalLocks.get(locksName);
         if (null == result) {
             result = createInterMutexLock(locksName);
-            mutexLocks.put(locksName, result);
+            internalLocks.put(locksName, result);
         }
-        return (InterMutexLock) result;
+        return (ExclusiveInternalLock) result;
     }
     
-    private InterMutexLock createInterMutexLock(final String locksName) {
-        InterReentrantMutexLock interReentrantMutexLock = createInterReentrantMutexLock(LockNodeUtil.generateLockSequenceNodePath(locksName));
-        return new InterMutexLock(locksName, interReentrantMutexLock, mutexLockRegistryService, currentInstance, computeNodeInstances);
+    private ExclusiveInternalLock createInterMutexLock(final String locksName) {
+        ReentrantInternalLock reentrantExclusiveLock = createInterReentrantMutexLock(LockNodeUtil.generateLockSequenceNodePath(locksName));
+        return new ExclusiveInternalLock(locksName, reentrantExclusiveLock, mutexLockRegistryService, currentInstance, computeNodeInstances);
     }
     
-    private InterReentrantMutexLock createInterReentrantMutexLock(final String lockNodePath) {
-        return new InterReentrantMutexLock(clusterRepository.getInternalReentrantMutexLock(lockNodePath));
+    private ReentrantInternalLock createInterReentrantMutexLock(final String lockNodePath) {
+        return new ReentrantInternalLock(clusterRepository.getInternalReentrantMutexLock(lockNodePath));
     }
     
     /**
@@ -82,11 +82,11 @@ public final class ShardingSphereInterMutexLockHolder {
      * @param locksName locks name
      * @return inter mutex lock
      */
-    public Optional<InterMutexLock> getInterMutexLock(final String locksName) {
-        if (mutexLocks.isEmpty()) {
+    public Optional<ExclusiveInternalLock> getInterMutexLock(final String locksName) {
+        if (internalLocks.isEmpty()) {
             return Optional.empty();
         }
-        return Optional.ofNullable((InterMutexLock) mutexLocks.get(locksName));
+        return Optional.ofNullable((ExclusiveInternalLock) internalLocks.get(locksName));
     }
     
     /**
@@ -95,13 +95,13 @@ public final class ShardingSphereInterMutexLockHolder {
      * @param locksName locks name
      * @return inter reentrant mutex lock
      */
-    public synchronized InterReentrantMutexLock getOrCreateInterReentrantMutexLock(final String locksName) {
-        MutexLock result = mutexLocks.get(locksName);
+    public synchronized ReentrantInternalLock getOrCreateInterReentrantMutexLock(final String locksName) {
+        InternalLock result = internalLocks.get(locksName);
         if (null == result) {
             result = createInterReentrantMutexLock(locksName);
-            mutexLocks.put(locksName, result);
+            internalLocks.put(locksName, result);
         }
-        return (InterReentrantMutexLock) result;
+        return (ReentrantInternalLock) result;
     }
     
     /**
@@ -110,11 +110,11 @@ public final class ShardingSphereInterMutexLockHolder {
      * @param locksName locks name
      * @return inter mutex lock
      */
-    public Optional<InterReentrantMutexLock> getInterReentrantMutexLock(final String locksName) {
-        if (mutexLocks.isEmpty()) {
+    public Optional<ReentrantInternalLock> getInterReentrantMutexLock(final String locksName) {
+        if (internalLocks.isEmpty()) {
             return Optional.empty();
         }
-        return Optional.ofNullable((InterReentrantMutexLock) mutexLocks.get(locksName));
+        return Optional.ofNullable((ReentrantInternalLock) internalLocks.get(locksName));
     }
     
     /**
@@ -133,7 +133,7 @@ public final class ShardingSphereInterMutexLockHolder {
         }
         for (String each : allGlobalLock) {
             Optional<String> generalLock = lockNodeService.parseLocksNodePath(each);
-            generalLock.ifPresent(optional -> mutexLocks.put(optional, createInterMutexLock(optional)));
+            generalLock.ifPresent(optional -> internalLocks.put(optional, createInterMutexLock(optional)));
         }
     }