You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2021/08/06 08:42:03 UTC

[shardingsphere] branch master updated: Pull down BootstrapInitializer.postInit() into AbstractBootstrapInitializer (#11682)

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

duanzhengqiang 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 f8fd3b4  Pull down BootstrapInitializer.postInit() into AbstractBootstrapInitializer (#11682)
f8fd3b4 is described below

commit f8fd3b468f80b252edeb0618b142632497bfbde1
Author: Liang Zhang <te...@163.com>
AuthorDate: Fri Aug 6 16:41:31 2021 +0800

    Pull down BootstrapInitializer.postInit() into AbstractBootstrapInitializer (#11682)
---
 .../src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java  | 1 -
 .../shardingsphere/proxy/initializer/BootstrapInitializer.java    | 8 --------
 .../proxy/initializer/impl/AbstractBootstrapInitializer.java      | 4 ++++
 .../proxy/initializer/impl/GovernanceBootstrapInitializer.java    | 2 +-
 4 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
index 5536822..5ba4e65 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
@@ -61,7 +61,6 @@ public final class Bootstrap {
         YamlProxyConfiguration yamlConfig = ProxyConfigurationLoader.load(bootstrapArgs.getConfigurationPath());
         BootstrapInitializer initializer = createBootstrapInitializer(yamlConfig);
         initializer.init(yamlConfig);
-        initializer.postInit(yamlConfig);
         new ShardingSphereProxy().start(bootstrapArgs.getPort());
     }
     
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializer.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializer.java
index 345b5c5..521b4ed 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializer.java
@@ -33,12 +33,4 @@ public interface BootstrapInitializer {
      * @throws SQLException SQL exception
      */
     void init(YamlProxyConfiguration yamlConfig) throws SQLException;
-    
-    /**
-     * Called after initialization finished.
-     * 
-     * @param yamlConfig YAML proxy configuration
-     */
-    default void postInit(YamlProxyConfiguration yamlConfig) {
-    }
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/AbstractBootstrapInitializer.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/AbstractBootstrapInitializer.java
index 9d5d344..7356fe5 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/AbstractBootstrapInitializer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/AbstractBootstrapInitializer.java
@@ -85,6 +85,7 @@ public abstract class AbstractBootstrapInitializer implements BootstrapInitializ
         ProxyContext.getInstance().init(metaDataContexts, transactionContexts);
         setDatabaseServerInfo();
         initScalingInternal(yamlConfig);
+        postInit(yamlConfig);
     }
     
     private ProxyConfiguration getProxyConfiguration(final YamlProxyConfiguration yamlConfig) {
@@ -225,4 +226,7 @@ public abstract class AbstractBootstrapInitializer implements BootstrapInitializ
         return schemaNames.stream()
                 .collect(Collectors.toMap(each -> each, each -> distMetaDataPersistService.getSchemaRuleService().load(each), (oldValue, currentValue) -> oldValue, LinkedHashMap::new));
     }
+    
+    protected void postInit(final YamlProxyConfiguration yamlConfig) {
+    }
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializer.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializer.java
index 5555f1f..5ef5c67 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializer.java
@@ -82,7 +82,7 @@ public final class GovernanceBootstrapInitializer extends AbstractBootstrapIniti
     }
     
     @Override
-    public void postInit(final YamlProxyConfiguration yamlConfig) {
+    protected void postInit(final YamlProxyConfiguration yamlConfig) {
         governanceRule.getRegistryCenter().onlineInstance(getSchemaNames(yamlConfig));
     }