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 e49c72fcf11 Merge GlobalLockPersistService and LockPersistService 
(#34171)
e49c72fcf11 is described below

commit e49c72fcf11654b26ddcda722907be78569e8c76
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Dec 26 23:21:27 2024 +0800

    Merge GlobalLockPersistService and LockPersistService (#34171)
---
 .../mode/lock/LockPersistService.java              | 44 ----------------------
 .../persist/service/GlobalLockPersistService.java  | 17 +++++++--
 2 files changed, 13 insertions(+), 48 deletions(-)

diff --git 
a/mode/core/src/main/java/org/apache/shardingsphere/mode/lock/LockPersistService.java
 
b/mode/core/src/main/java/org/apache/shardingsphere/mode/lock/LockPersistService.java
deleted file mode 100644
index 08c0ee4324e..00000000000
--- 
a/mode/core/src/main/java/org/apache/shardingsphere/mode/lock/LockPersistService.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.mode.lock;
-
-import org.apache.shardingsphere.infra.lock.LockDefinition;
-
-/**
- * Lock persist service.
- *
- * @param <T> type of lock definition
- */
-public interface LockPersistService<T extends LockDefinition> {
-    
-    /**
-     * Try lock.
-     *
-     * @param lockDefinition lock definition
-     * @param timeoutMillis timeout millis
-     * @return is locked or not
-     */
-    boolean tryLock(T lockDefinition, long timeoutMillis);
-    
-    /**
-     * Unlock.
-     *
-     * @param lockDefinition lock definition
-     */
-    void unlock(T lockDefinition);
-}
diff --git 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/service/GlobalLockPersistService.java
 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/service/GlobalLockPersistService.java
index f20366e5e52..b3a92fd61e0 100644
--- 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/service/GlobalLockPersistService.java
+++ 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/service/GlobalLockPersistService.java
@@ -19,23 +19,32 @@ package 
org.apache.shardingsphere.mode.manager.cluster.persist.service;
 
 import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.mode.lock.global.GlobalLockDefinition;
-import org.apache.shardingsphere.mode.lock.LockPersistService;
 import 
org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
 
 /**
  * Global lock persist service.
  */
 @RequiredArgsConstructor
-public final class GlobalLockPersistService implements 
LockPersistService<GlobalLockDefinition> {
+public final class GlobalLockPersistService {
     
     private final ClusterPersistRepository repository;
     
-    @Override
+    /**
+     * Try lock.
+     *
+     * @param lockDefinition lock definition
+     * @param timeoutMillis timeout millis
+     * @return is locked or not
+     */
     public boolean tryLock(final GlobalLockDefinition lockDefinition, final 
long timeoutMillis) {
         return 
repository.getDistributedLockHolder().getDistributedLock(lockDefinition.getLockKey()).tryLock(timeoutMillis);
     }
     
-    @Override
+    /**
+     * Unlock.
+     *
+     * @param lockDefinition lock definition
+     */
     public void unlock(final GlobalLockDefinition lockDefinition) {
         
repository.getDistributedLockHolder().getDistributedLock(lockDefinition.getLockKey()).unlock();
     }

Reply via email to