You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by me...@apache.org on 2022/05/31 03:49:10 UTC

[shardingsphere] branch master updated: Optimize lock judge engine (#18083)

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

menghaoran 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 c468e6ffe34 Optimize lock judge engine (#18083)
c468e6ffe34 is described below

commit c468e6ffe343f52e03f99127fbea429a00ba4f6a
Author: gin <ja...@163.com>
AuthorDate: Tue May 31 11:49:04 2022 +0800

    Optimize lock judge engine (#18083)
---
 .../shardingsphere/infra/lock/LockJudgeEngine.java | 35 ----------------------
 .../lock/ShardingSphereLockJudgeEngine.java        | 11 +++++--
 .../communication/DatabaseCommunicationEngine.java |  3 +-
 3 files changed, 9 insertions(+), 40 deletions(-)

diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/lock/LockJudgeEngine.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/lock/LockJudgeEngine.java
deleted file mode 100644
index 8142fad6cce..00000000000
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/lock/LockJudgeEngine.java
+++ /dev/null
@@ -1,35 +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.infra.lock;
-
-import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
-
-/**
- * Lock judge engine.
- */
-public interface LockJudgeEngine {
-    
-    /**
-     * Is locked.
-     *
-     * @param databaseName database name
-     * @param sqlStatement SQL statement
-     * @return is locked or not
-     */
-    boolean isLocked(String databaseName, SQLStatement sqlStatement);
-}
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/lock/ShardingSphereLockJudgeEngine.java b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/lock/ShardingSphereLockJudgeEngine.java
index f11396f34f6..bb80d07daf2 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/lock/ShardingSphereLockJudgeEngine.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/lock/ShardingSphereLockJudgeEngine.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.mode.manager.lock;
 
 import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.infra.lock.LockContext;
-import org.apache.shardingsphere.infra.lock.LockJudgeEngine;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DDLStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.DMLStatement;
@@ -29,11 +28,17 @@ import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectState
  * Lock judge engine for ShardingSphere.
  */
 @RequiredArgsConstructor
-public final class ShardingSphereLockJudgeEngine implements LockJudgeEngine {
+public final class ShardingSphereLockJudgeEngine {
     
     private final LockContext lockContext;
     
-    @Override
+    /**
+     * Is locked.
+     *
+     * @param databaseName database name
+     * @param sqlStatement sql statement
+     * @return is locked or not
+     */
     public boolean isLocked(final String databaseName, final SQLStatement sqlStatement) {
         if (sqlStatement instanceof DMLStatement) {
             if (sqlStatement instanceof SelectStatement) {
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
index 932c3df2e8c..c95947b5fc7 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/DatabaseCommunicationEngine.java
@@ -31,7 +31,6 @@ import org.apache.shardingsphere.infra.executor.sql.context.ExecutionContext;
 import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult;
 import org.apache.shardingsphere.infra.executor.sql.execute.result.update.UpdateResult;
 import org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.JDBCDriverType;
-import org.apache.shardingsphere.infra.lock.LockJudgeEngine;
 import org.apache.shardingsphere.infra.merge.MergeEngine;
 import org.apache.shardingsphere.infra.merge.result.MergedResult;
 import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
@@ -82,7 +81,7 @@ public abstract class DatabaseCommunicationEngine<T> {
     
     private final BackendConnection<?> backendConnection;
     
-    private final LockJudgeEngine lockJudgeEngine;
+    private final ShardingSphereLockJudgeEngine lockJudgeEngine;
     
     public DatabaseCommunicationEngine(final String driverType, final ShardingSphereDatabase database, final LogicSQL logicSQL, final BackendConnection<?> backendConnection) {
         this.driverType = driverType;