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/23 05:27:19 UTC

[shardingsphere] branch master updated: Adjust the order of methods (#18527)

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 0841f866e0a Adjust the order of methods (#18527)
0841f866e0a is described below

commit 0841f866e0a240b4054130139868d949c524c96d
Author: natehuang <na...@tencent.com>
AuthorDate: Thu Jun 23 13:27:13 2022 +0800

    Adjust the order of methods (#18527)
---
 ...SQLNormalReplicationDatabaseDiscoveryProviderAlgorithm.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/type/MySQLNormalReplicationDatabaseDiscoveryProviderAlgorithm.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/type/MySQLNormalReplicationDatabaseDiscoveryProvi [...]
index f534ef5ff4d..5e312384fb2 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/type/MySQLNormalReplicationDatabaseDiscoveryProviderAlgorithm.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-provider/shardingsphere-db-discovery-mysql/src/main/java/org/apache/shardingsphere/dbdiscovery/mysql/type/MySQLNormalReplicationDatabaseDiscoveryProviderAlgorithm.java
@@ -84,6 +84,11 @@ public final class MySQLNormalReplicationDatabaseDiscoveryProviderAlgorithm impl
             }
         }, executorService);
     }
+
+    @Override
+    public boolean isPrimaryInstance(final DataSource dataSource) throws SQLException {
+        return !getReplicationInstances(dataSource).isEmpty() && isNotReadonlyInstance(dataSource);
+    }
     
     private Collection<String> getReplicationInstances(final DataSource dataSource) throws SQLException {
         try (
@@ -112,11 +117,6 @@ public final class MySQLNormalReplicationDatabaseDiscoveryProviderAlgorithm impl
         }
     }
     
-    @Override
-    public boolean isPrimaryInstance(final DataSource dataSource) throws SQLException {
-        return !getReplicationInstances(dataSource).isEmpty() && isNotReadonlyInstance(dataSource);
-    }
-    
     @Override
     public ReplicaDataSourceStatus loadReplicaStatus(final DataSource replicaDataSource) throws SQLException {
         try (