You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by xi...@apache.org on 2021/01/05 06:11:31 UTC

[shardingsphere] branch master updated: #7318, remove the inheritance between HAType and ShardingSphereAlgorithm (#8889)

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

xiaoyu 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 6f1f5dd  #7318, remove the inheritance between HAType and ShardingSphereAlgorithm (#8889)
6f1f5dd is described below

commit 6f1f5dd85d8b0d8c1a65c86b441350447ba42823
Author: Zhang Yonglun <zh...@apache.org>
AuthorDate: Tue Jan 5 14:11:01 2021 +0800

    #7318, remove the inheritance between HAType and ShardingSphereAlgorithm (#8889)
    
    * #7318, remove the inheritance between HAType and ShardingSphereAlgorithm
    
    * #7318, PeriodicalMonitor => PeriodicalUpdate
---
 .../main/java/org/apache/shardingsphere/ha/spi/HAType.java   | 12 ++++++------
 .../main/java/org/apache/shardingsphere/ha/rule/HARule.java  |  8 ++++----
 .../apache/shardingsphere/ha/fixture/TestHATypeFixture.java  |  4 ++--
 .../java/org/apache/shardingsphere/ha/mgr/MGRHAType.java     |  4 ++--
 .../ha/route/fixture/TestRouteHATypeFixture.java             |  4 ++--
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-api/src/main/java/org/apache/shardingsphere/ha/spi/HAType.java b/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-api/src/main/java/org/apache/shardingsphere/ha/spi/HAType.java
index c72a968..e90804e 100644
--- a/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-api/src/main/java/org/apache/shardingsphere/ha/spi/HAType.java
+++ b/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-api/src/main/java/org/apache/shardingsphere/ha/spi/HAType.java
@@ -17,7 +17,7 @@
 
 package org.apache.shardingsphere.ha.spi;
 
-import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithm;
+import org.apache.shardingsphere.infra.spi.typed.TypedSPI;
 
 import javax.sql.DataSource;
 import java.sql.SQLException;
@@ -26,7 +26,7 @@ import java.util.Map;
 /**
  * HA type.
  */
-public interface HAType extends ShardingSphereAlgorithm {
+public interface HAType extends TypedSPI {
     
     /**
      * Check HA config.
@@ -46,15 +46,15 @@ public interface HAType extends ShardingSphereAlgorithm {
     void updatePrimaryDataSource(Map<String, DataSource> dataSourceMap, String schemaName);
     
     /**
-     * Start periodical monitor.
+     * Start periodical update.
      *
      * @param dataSourceMap data source map
      * @param schemaName schema name
      */
-    void startPeriodicalMonitor(Map<String, DataSource> dataSourceMap, String schemaName);
+    void startPeriodicalUpdate(Map<String, DataSource> dataSourceMap, String schemaName);
     
     /**
-     * Stop periodical monitor.
+     * Stop periodical update.
      */
-    void stopPeriodicalMonitor();
+    void stopPeriodicalUpdate();
 }
diff --git a/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-common/src/main/java/org/apache/shardingsphere/ha/rule/HARule.java b/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-common/src/main/java/org/apache/shardingsphere/ha/rule/HARule.java
index 025abe5..dabd39b 100644
--- a/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-common/src/main/java/org/apache/shardingsphere/ha/rule/HARule.java
+++ b/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-common/src/main/java/org/apache/shardingsphere/ha/rule/HARule.java
@@ -75,11 +75,11 @@ public final class HARule implements DataSourceContainedRule, StatusContainedRul
             haType = TypedSPIRegistry.getRegisteredService(HAType.class, config.getHaType().getType(), config.getHaType().getProps());
             haType.updatePrimaryDataSource(dataSourceMap, schemaName);
         } else {
-            haType.stopPeriodicalMonitor();
+            haType.stopPeriodicalUpdate();
         }
         try {
             haType.checkHAConfig(dataSourceMap, schemaName);
-            haType.startPeriodicalMonitor(dataSourceMap, schemaName);
+            haType.startPeriodicalUpdate(dataSourceMap, schemaName);
         } catch (final SQLException ex) {
             throw new ShardingSphereException(ex);
         }
@@ -101,11 +101,11 @@ public final class HARule implements DataSourceContainedRule, StatusContainedRul
             haType = TypedSPIRegistry.getRegisteredService(HAType.class, config.getHaType().getType(), config.getHaType().getProps());
             haType.updatePrimaryDataSource(dataSourceMap, schemaName);
         } else {
-            haType.stopPeriodicalMonitor();
+            haType.stopPeriodicalUpdate();
         }
         try {
             haType.checkHAConfig(dataSourceMap, schemaName);
-            haType.startPeriodicalMonitor(dataSourceMap, schemaName);
+            haType.startPeriodicalUpdate(dataSourceMap, schemaName);
         } catch (final SQLException ex) {
             throw new ShardingSphereException(ex);
         }
diff --git a/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-common/src/test/java/org/apache/shardingsphere/ha/fixture/TestHATypeFixture.java b/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-common/src/test/java/org/apache/shardingsphere/ha/fixture/TestHATypeFixture.java
index e9a3596..644c13f 100644
--- a/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-common/src/test/java/org/apache/shardingsphere/ha/fixture/TestHATypeFixture.java
+++ b/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-common/src/test/java/org/apache/shardingsphere/ha/fixture/TestHATypeFixture.java
@@ -36,11 +36,11 @@ public final class TestHATypeFixture implements HAType {
     }
     
     @Override
-    public void startPeriodicalMonitor(final Map<String, DataSource> dataSourceMap, final String schemaName) {
+    public void startPeriodicalUpdate(final Map<String, DataSource> dataSourceMap, final String schemaName) {
     }
     
     @Override
-    public void stopPeriodicalMonitor() {
+    public void stopPeriodicalUpdate() {
     }
     
     @Override
diff --git a/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-provider/shardingsphere-ha-mgr/src/main/java/org/apache/shardingsphere/ha/mgr/MGRHAType.java b/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-provider/shardingsphere-ha-mgr/src/main/java/org/apache/shardingsphere/ha/mgr/MGRHAType.java
index 8c2b5dd..212ed01 100644
--- a/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-provider/shardingsphere-ha-mgr/src/main/java/org/apache/shardingsphere/ha/mgr/MGRHAType.java
+++ b/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-provider/shardingsphere-ha-mgr/src/main/java/org/apache/shardingsphere/ha/mgr/MGRHAType.java
@@ -169,7 +169,7 @@ public final class MGRHAType implements HAType {
     }
     
     @Override
-    public void startPeriodicalMonitor(final Map<String, DataSource> dataSourceMap, final String schemaName) {
+    public void startPeriodicalUpdate(final Map<String, DataSource> dataSourceMap, final String schemaName) {
         if (null == coordinatorRegistryCenter) {
             ZookeeperConfiguration zkConfig = new ZookeeperConfiguration(props.getProperty("zkServerLists"), "mgr-elasticjob");
             coordinatorRegistryCenter = new ZookeeperRegistryCenter(zkConfig);
@@ -181,7 +181,7 @@ public final class MGRHAType implements HAType {
     }
     
     @Override
-    public void stopPeriodicalMonitor() {
+    public void stopPeriodicalUpdate() {
         scheduleJobBootstrap.shutdown();
     }
     
diff --git a/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-route/src/test/java/org/apache/shardingsphere/ha/route/fixture/TestRouteHATypeFixture.java b/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-route/src/test/java/org/apache/shardingsphere/ha/route/fixture/TestRouteHATypeFixture.java
index c07563b..f04b87c 100644
--- a/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-route/src/test/java/org/apache/shardingsphere/ha/route/fixture/TestRouteHATypeFixture.java
+++ b/shardingsphere-features/shardingsphere-ha/shardingsphere-ha-route/src/test/java/org/apache/shardingsphere/ha/route/fixture/TestRouteHATypeFixture.java
@@ -37,11 +37,11 @@ public final class TestRouteHATypeFixture implements HAType {
     }
     
     @Override
-    public void startPeriodicalMonitor(final Map<String, DataSource> dataSourceMap, final String schemaName) {
+    public void startPeriodicalUpdate(final Map<String, DataSource> dataSourceMap, final String schemaName) {
     }
     
     @Override
-    public void stopPeriodicalMonitor() {
+    public void stopPeriodicalUpdate() {
     }
     
     @Override