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 2022/04/29 23:16:39 UTC

[shardingsphere] branch master updated: Add more SPI factories (#17215)

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 64683ecf52f Add more SPI factories (#17215)
64683ecf52f is described below

commit 64683ecf52f8fd7b7918d8b61f8ace4c5a410116
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Apr 30 07:16:21 2022 +0800

    Add more SPI factories (#17215)
    
    * Refactor SQLCheckerFactory
    
    * Refactor SQLCheckerFactory
    
    * Add ContextManagerLifecycleListenerFactory
    
    * For checkstyle
    
    * Add AuthorityProviderAlgorithmFactory
    
    * Add AuthorityProviderAlgorithmFactory
    
    * Add AuthorityProviderAlgorithmFactory
    
    * Add AuthorityProviderAlgorithmFactory
    
    * Add ShardingSphereYamlConstructFactory
    
    * Refactor JobRateLimitAlgorithm
    
    * Add ShardingSphereYamlTupleProcessorFactory
    
    * Add MetaDataRefresherFactory
---
 .../RuleBasedSchemaMetaDataBuilderFactory.java     |  2 +-
 .../ShardingSphereYamlConstructFactory.java        | 24 +++++++++++++++----
 .../constructor/ShardingSphereYamlConstructor.java |  7 +-----
 .../representer/ShardingSphereYamlRepresenter.java |  8 ++-----
 .../ShardingSphereYamlTupleProcessorFactory.java}  | 23 +++++++-----------
 .../context/refresher/MetaDataRefreshEngine.java   |  7 +-----
 .../infra/context/refresher/MetaDataRefresher.java |  4 ++--
 .../refresher/MetaDataRefresherFactory.java}       | 25 ++++++++++---------
 .../infra/executor/check/SQLCheckEngine.java       | 14 ++++-------
 .../infra/executor/check/SQLCheckerFactory.java}   | 18 +++++++-------
 .../merge/engine/ResultProcessEngineFactory.java   |  2 +-
 .../spi/AuthorityProviderAlgorithmFactory.java     | 28 ++++++++++------------
 .../authority/rule/AuthorityRule.java              |  9 ++-----
 .../authority/checker/AuthorityCheckerTest.java    | 15 ++++--------
 .../NativeAuthorityProviderAlgorithmTest.java      | 19 ---------------
 .../data/pipeline/api/job/JobOperationType.java    |  3 +--
 .../spi/ratelimit/JobRateLimitAlgorithm.java       |  2 +-
 .../ContextManagerLifecycleListenerFactory.java    | 21 +++++++---------
 .../information/SelectInformationExecutorTest.java |  6 -----
 .../proxy/initializer/BootstrapInitializer.java    | 10 ++------
 .../MySQLAuthenticationHandlerTest.java            |  8 +------
 21 files changed, 93 insertions(+), 162 deletions(-)

diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/RuleBasedSchemaMetaDataBuilderFactory.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/RuleBasedSchemaMetaDataBuilderFactory.java
index 7631ddfdf07..4eaa74c6ef9 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/RuleBasedSchemaMetaDataBuilderFactory.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/RuleBasedSchemaMetaDataBuilderFactory.java
@@ -37,7 +37,7 @@ public final class RuleBasedSchemaMetaDataBuilderFactory {
     /**
      * Create new instance of rule based schema meta data builder.
      * 
-     * @param rules ShardingSphere rules
+     * @param rules rules
      * @return new instance of rule based schema meta data builder
      */
     @SuppressWarnings("rawtypes")
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/job/JobOperationType.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/constructor/ShardingSphereYamlConstructFactory.java
similarity index 54%
copy from shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/job/JobOperationType.java
copy to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/constructor/ShardingSphereYamlConstructFactory.java
index 2a51aefb5d9..82c4c69b23a 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/job/JobOperationType.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/constructor/ShardingSphereYamlConstructFactory.java
@@ -15,13 +15,27 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.data.pipeline.api.job;
+package org.apache.shardingsphere.infra.yaml.engine.constructor;
+
+import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
+
+import java.util.Collection;
 
 /**
- * Job operation type.
+ * ShardingSphere YAML construct factory.
  */
-public enum JobOperationType {
+public final class ShardingSphereYamlConstructFactory {
+    
+    static {
+        ShardingSphereServiceLoader.register(ShardingSphereYamlConstruct.class);
+    }
     
-    INSERT, DELETE, UPDATE, SELECT,
-    SYSTEM_LOAD, CPU_USAGE,
+    /**
+     * Create new instances of ShardingSphere YAML construct.
+     * 
+     * @return new instances of ShardingSphere YAML construct
+     */
+    public static Collection<ShardingSphereYamlConstruct> newInstances() {
+        return ShardingSphereServiceLoader.getServiceInstances(ShardingSphereYamlConstruct.class);
+    }
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/constructor/ShardingSphereYamlConstructor.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/constructor/ShardingSphereYamlConstructor.java
index 18eb51af272..f3ba3e764ca 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/constructor/ShardingSphereYamlConstructor.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/constructor/ShardingSphereYamlConstructor.java
@@ -18,7 +18,6 @@
 package org.apache.shardingsphere.infra.yaml.engine.constructor;
 
 import org.apache.shardingsphere.infra.yaml.config.swapper.YamlRuleConfigurationSwapperEngine;
-import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
 import org.yaml.snakeyaml.TypeDescription;
 import org.yaml.snakeyaml.constructor.Construct;
 import org.yaml.snakeyaml.constructor.Constructor;
@@ -32,17 +31,13 @@ import java.util.Map;
  */
 public class ShardingSphereYamlConstructor extends Constructor {
     
-    static {
-        ShardingSphereServiceLoader.register(ShardingSphereYamlConstruct.class);
-    }
-    
     private final Map<Class<?>, Construct> typeConstructs = new HashMap<>();
     
     private final Class<?> rootClass;
     
     public ShardingSphereYamlConstructor(final Class<?> rootClass) {
         super(rootClass);
-        ShardingSphereServiceLoader.getServiceInstances(ShardingSphereYamlConstruct.class).forEach(each -> typeConstructs.put(each.getType(), each));
+        ShardingSphereYamlConstructFactory.newInstances().forEach(each -> typeConstructs.put(each.getType(), each));
         YamlRuleConfigurationSwapperEngine.getYamlShortcuts().forEach((key, value) -> addTypeDescription(new TypeDescription(value, key)));
         this.rootClass = rootClass;
     }
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/representer/ShardingSphereYamlRepresenter.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/representer/ShardingSphereYamlRepresenter.java
index 8fd70f81a92..27bc3d95705 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/representer/ShardingSphereYamlRepresenter.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/representer/ShardingSphereYamlRepresenter.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.infra.yaml.engine.representer;
 import org.apache.shardingsphere.infra.yaml.config.swapper.YamlRuleConfigurationSwapperEngine;
 import org.apache.shardingsphere.infra.yaml.engine.representer.processor.DefaultYamlTupleProcessor;
 import org.apache.shardingsphere.infra.yaml.engine.representer.processor.ShardingSphereYamlTupleProcessor;
-import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
+import org.apache.shardingsphere.infra.yaml.engine.representer.processor.ShardingSphereYamlTupleProcessorFactory;
 import org.yaml.snakeyaml.DumperOptions;
 import org.yaml.snakeyaml.introspector.Property;
 import org.yaml.snakeyaml.nodes.Node;
@@ -38,10 +38,6 @@ import java.util.Map.Entry;
  */
 public final class ShardingSphereYamlRepresenter extends Representer {
     
-    static {
-        ShardingSphereServiceLoader.register(ShardingSphereYamlTupleProcessor.class);
-    }
-    
     public ShardingSphereYamlRepresenter() {
         YamlRuleConfigurationSwapperEngine.getYamlShortcuts().forEach((key, value) -> addClassTag(value, new Tag(key)));
     }
@@ -49,7 +45,7 @@ public final class ShardingSphereYamlRepresenter extends Representer {
     @Override
     protected NodeTuple representJavaBeanProperty(final Object javaBean, final Property property, final Object propertyValue, final Tag customTag) {
         NodeTuple nodeTuple = super.representJavaBeanProperty(javaBean, property, propertyValue, customTag);
-        for (ShardingSphereYamlTupleProcessor each : ShardingSphereServiceLoader.getServiceInstances(ShardingSphereYamlTupleProcessor.class)) {
+        for (ShardingSphereYamlTupleProcessor each : ShardingSphereYamlTupleProcessorFactory.newInstances()) {
             if (property.getName().equals(each.getTupleName())) {
                 return each.process(nodeTuple);
             }
diff --git a/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/representer/processor/ShardingSphereYamlTupleProcessorFactory.java
similarity index 58%
copy from shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java
copy to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/representer/processor/ShardingSphereYamlTupleProcessorFactory.java
index bcb9136a09f..e0586e38f4a 100644
--- a/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/engine/representer/processor/ShardingSphereYamlTupleProcessorFactory.java
@@ -15,35 +15,30 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.merge.engine;
+package org.apache.shardingsphere.infra.yaml.engine.representer.processor;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
-import org.apache.shardingsphere.spi.type.ordered.OrderedSPIRegistry;
 
 import java.util.Collection;
-import java.util.Map;
 
 /**
- * Result process engine factory.
+ * ShardingSphere YAML tuple processor factory.
  */
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ResultProcessEngineFactory {
+public final class ShardingSphereYamlTupleProcessorFactory {
     
     static {
-        ShardingSphereServiceLoader.register(ResultProcessEngine.class);
+        ShardingSphereServiceLoader.register(ShardingSphereYamlTupleProcessor.class);
     }
     
     /**
-     * Create new instance of result process engine.
-     * 
-     * @param rules ShardingSphere rules
-     * @return new instance of result process engine
+     * Create new instances of ShardingSphere YAML tuple processor.
+     *
+     * @return new instances of ShardingSphere YAML tuple processor
      */
-    @SuppressWarnings("rawtypes")
-    public static Map<ShardingSphereRule, ResultProcessEngine> newInstance(final Collection<ShardingSphereRule> rules) {
-        return OrderedSPIRegistry.getRegisteredServices(ResultProcessEngine.class, rules);
+    public static Collection<ShardingSphereYamlTupleProcessor> newInstances() {
+        return ShardingSphereServiceLoader.getServiceInstances(ShardingSphereYamlTupleProcessor.class);
     }
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/MetaDataRefreshEngine.java b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/MetaDataRefreshEngine.java
index 476a2036d0f..26b613c3e89 100644
--- a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/MetaDataRefreshEngine.java
+++ b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/MetaDataRefreshEngine.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
 import org.apache.shardingsphere.infra.federation.optimizer.context.planner.OptimizerPlannerContext;
 import org.apache.shardingsphere.infra.federation.optimizer.metadata.FederationDatabaseMetaData;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
-import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
 import org.apache.shardingsphere.spi.type.typed.TypedSPIRegistry;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 
@@ -42,10 +41,6 @@ import java.util.function.Supplier;
 @RequiredArgsConstructor
 public final class MetaDataRefreshEngine {
     
-    static {
-        ShardingSphereServiceLoader.register(MetaDataRefresher.class);
-    }
-    
     private static final Set<Class<? extends SQLStatement>> IGNORABLE_SQL_STATEMENT_CLASSES = Collections.newSetFromMap(new ConcurrentHashMap<>());
     
     private final ShardingSphereMetaData metaData;
@@ -69,7 +64,7 @@ public final class MetaDataRefreshEngine {
         if (IGNORABLE_SQL_STATEMENT_CLASSES.contains(sqlStatementClass)) {
             return;
         }
-        Optional<MetaDataRefresher> schemaRefresher = TypedSPIRegistry.findRegisteredService(MetaDataRefresher.class, sqlStatementClass.getSuperclass().getName());
+        Optional<MetaDataRefresher> schemaRefresher = MetaDataRefresherFactory.newInstance(sqlStatementClass);
         if (schemaRefresher.isPresent()) {
             String schemaName = sqlStatementContext.getTablesContext().getSchemaName().orElse(sqlStatementContext.getDatabaseType().getDefaultSchema(metaData.getDatabaseName()));
             schemaRefresher.get().refresh(metaData, federationMetaData, optimizerPlanners, logicDataSourceNamesSupplier.get(), schemaName, sqlStatementContext.getSqlStatement(), props);
diff --git a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/MetaDataRefresher.java b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/MetaDataRefresher.java
index 91e60587fbc..b03535babd1 100644
--- a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/MetaDataRefresher.java
+++ b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/MetaDataRefresher.java
@@ -29,14 +29,14 @@ import java.util.Collection;
 import java.util.Map;
 
 /**
- * ShardingSphere schema refresher.
+ * Meta data refresher.
  *
  * @param <T> type of SQL statement
  */
 public interface MetaDataRefresher<T extends SQLStatement> extends StatelessTypedSPI {
     
     /**
-     * Refresh ShardingSphere schema.
+     * Refresh schema.
      *
      * @param metaData meta data
      * @param database federation database meta data                      
diff --git a/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/MetaDataRefresherFactory.java
similarity index 58%
copy from shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java
copy to shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/MetaDataRefresherFactory.java
index bcb9136a09f..67fc81d54f5 100644
--- a/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java
+++ b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/MetaDataRefresherFactory.java
@@ -15,35 +15,34 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.merge.engine;
+package org.apache.shardingsphere.infra.context.refresher;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
-import org.apache.shardingsphere.spi.type.ordered.OrderedSPIRegistry;
+import org.apache.shardingsphere.spi.type.typed.TypedSPIRegistry;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 
-import java.util.Collection;
-import java.util.Map;
+import java.util.Optional;
 
 /**
- * Result process engine factory.
+ * Meta data refresher factory.
  */
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ResultProcessEngineFactory {
+public final class MetaDataRefresherFactory {
     
     static {
-        ShardingSphereServiceLoader.register(ResultProcessEngine.class);
+        ShardingSphereServiceLoader.register(MetaDataRefresher.class);
     }
     
     /**
-     * Create new instance of result process engine.
+     * Create new instance of meta data refresher.
      * 
-     * @param rules ShardingSphere rules
-     * @return new instance of result process engine
+     * @param sqlStatementClass SQL statement class
+     * @return new instance of meta data refresher
      */
     @SuppressWarnings("rawtypes")
-    public static Map<ShardingSphereRule, ResultProcessEngine> newInstance(final Collection<ShardingSphereRule> rules) {
-        return OrderedSPIRegistry.getRegisteredServices(ResultProcessEngine.class, rules);
+    public static Optional<MetaDataRefresher> newInstance(final Class<? extends SQLStatement> sqlStatementClass) {
+        return TypedSPIRegistry.findRegisteredService(MetaDataRefresher.class, sqlStatementClass.getSuperclass().getName());
     }
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/check/SQLCheckEngine.java b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/check/SQLCheckEngine.java
index 0ae0dcc77a8..95e8d576457 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/check/SQLCheckEngine.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/check/SQLCheckEngine.java
@@ -22,8 +22,6 @@ import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import org.apache.shardingsphere.infra.metadata.user.Grantee;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
-import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
-import org.apache.shardingsphere.spi.type.ordered.OrderedSPIRegistry;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 
 import java.util.Collection;
@@ -38,10 +36,6 @@ import java.util.function.BiPredicate;
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
 public final class SQLCheckEngine {
     
-    static {
-        ShardingSphereServiceLoader.register(SQLChecker.class);
-    }
-    
     /**
      * Check database.
      *
@@ -52,7 +46,7 @@ public final class SQLCheckEngine {
      */
     @SuppressWarnings({"rawtypes", "unchecked"})
     public static boolean check(final String databaseName, final Collection<ShardingSphereRule> rules, final Grantee grantee) {
-        for (Entry<ShardingSphereRule, SQLChecker> entry : OrderedSPIRegistry.getRegisteredServices(SQLChecker.class, rules).entrySet()) {
+        for (Entry<ShardingSphereRule, SQLChecker> entry : SQLCheckerFactory.newInstance(rules).entrySet()) {
             boolean checkResult = entry.getValue().check(databaseName, grantee, entry.getKey());
             if (!checkResult) {
                 return false;
@@ -74,7 +68,7 @@ public final class SQLCheckEngine {
     @SuppressWarnings({"rawtypes", "unchecked"})
     public static void check(final SQLStatement sqlStatement, final List<Object> parameters, final Collection<ShardingSphereRule> rules,
                              final String currentDatabase, final Map<String, ShardingSphereMetaData> metaDataMap, final Grantee grantee) {
-        for (Entry<ShardingSphereRule, SQLChecker> entry : OrderedSPIRegistry.getRegisteredServices(SQLChecker.class, rules).entrySet()) {
+        for (Entry<ShardingSphereRule, SQLChecker> entry : SQLCheckerFactory.newInstance(rules).entrySet()) {
             SQLCheckResult checkResult = entry.getValue().check(sqlStatement, parameters, grantee, currentDatabase, metaDataMap, entry.getKey());
             if (!checkResult.isPassed()) {
                 throw new SQLCheckException(checkResult.getErrorMessage());
@@ -93,7 +87,7 @@ public final class SQLCheckEngine {
         if (rules.isEmpty()) {
             return false;
         }
-        for (Entry<ShardingSphereRule, SQLChecker> entry : OrderedSPIRegistry.getRegisteredServices(SQLChecker.class, rules).entrySet()) {
+        for (Entry<ShardingSphereRule, SQLChecker> entry : SQLCheckerFactory.newInstance(rules).entrySet()) {
             boolean checkResult = entry.getValue().check(user, entry.getKey());
             if (!checkResult) {
                 return false;
@@ -115,7 +109,7 @@ public final class SQLCheckEngine {
         if (rules.isEmpty()) {
             return false;
         }
-        for (Entry<ShardingSphereRule, SQLChecker> entry : OrderedSPIRegistry.getRegisteredServices(SQLChecker.class, rules).entrySet()) {
+        for (Entry<ShardingSphereRule, SQLChecker> entry : SQLCheckerFactory.newInstance(rules).entrySet()) {
             boolean checkResult = entry.getValue().check(user, validate, cipher, entry.getKey());
             if (!checkResult) {
                 return false;
diff --git a/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/check/SQLCheckerFactory.java
similarity index 69%
copy from shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java
copy to shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/check/SQLCheckerFactory.java
index bcb9136a09f..25a39370b92 100644
--- a/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/check/SQLCheckerFactory.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.merge.engine;
+package org.apache.shardingsphere.infra.executor.check;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
@@ -27,23 +27,23 @@ import java.util.Collection;
 import java.util.Map;
 
 /**
- * Result process engine factory.
+ * SQL checker factory.
  */
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ResultProcessEngineFactory {
+public final class SQLCheckerFactory {
     
     static {
-        ShardingSphereServiceLoader.register(ResultProcessEngine.class);
+        ShardingSphereServiceLoader.register(SQLChecker.class);
     }
     
     /**
-     * Create new instance of result process engine.
+     * Create new instance of SQL checker.
      * 
-     * @param rules ShardingSphere rules
-     * @return new instance of result process engine
+     * @param rules rules
+     * @return new instance of SQL checker
      */
     @SuppressWarnings("rawtypes")
-    public static Map<ShardingSphereRule, ResultProcessEngine> newInstance(final Collection<ShardingSphereRule> rules) {
-        return OrderedSPIRegistry.getRegisteredServices(ResultProcessEngine.class, rules);
+    public static Map<ShardingSphereRule, SQLChecker> newInstance(final Collection<ShardingSphereRule> rules) {
+        return OrderedSPIRegistry.getRegisteredServices(SQLChecker.class, rules);
     }
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java b/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java
index bcb9136a09f..6860bc64ac1 100644
--- a/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java
+++ b/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java
@@ -39,7 +39,7 @@ public final class ResultProcessEngineFactory {
     /**
      * Create new instance of result process engine.
      * 
-     * @param rules ShardingSphere rules
+     * @param rules rules
      * @return new instance of result process engine
      */
     @SuppressWarnings("rawtypes")
diff --git a/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java b/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-api/src/main/java/org/apache/shardingsphere/authority/spi/AuthorityProviderAlgorithmFactory.java
similarity index 55%
copy from shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java
copy to shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-api/src/main/java/org/apache/shardingsphere/authority/spi/AuthorityProviderAlgorithmFactory.java
index bcb9136a09f..edddfdc2069 100644
--- a/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java
+++ b/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-api/src/main/java/org/apache/shardingsphere/authority/spi/AuthorityProviderAlgorithmFactory.java
@@ -15,35 +15,31 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.merge.engine;
+package org.apache.shardingsphere.authority.spi;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
+import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
+import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmFactory;
 import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
-import org.apache.shardingsphere.spi.type.ordered.OrderedSPIRegistry;
-
-import java.util.Collection;
-import java.util.Map;
 
 /**
- * Result process engine factory.
- */
+ * Authority provide algorithm factory.
+*/
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ResultProcessEngineFactory {
+public final class AuthorityProviderAlgorithmFactory {
     
     static {
-        ShardingSphereServiceLoader.register(ResultProcessEngine.class);
+        ShardingSphereServiceLoader.register(AuthorityProviderAlgorithm.class);
     }
     
     /**
-     * Create new instance of result process engine.
+     * Create new instance of authority provide algorithm.
      * 
-     * @param rules ShardingSphere rules
-     * @return new instance of result process engine
+     * @param authorityProviderConfig authority provider configuration
+     * @return new instance of authority provide algorithm
      */
-    @SuppressWarnings("rawtypes")
-    public static Map<ShardingSphereRule, ResultProcessEngine> newInstance(final Collection<ShardingSphereRule> rules) {
-        return OrderedSPIRegistry.getRegisteredServices(ResultProcessEngine.class, rules);
+    public static AuthorityProviderAlgorithm newInstance(final ShardingSphereAlgorithmConfiguration authorityProviderConfig) {
+        return ShardingSphereAlgorithmFactory.createAlgorithm(authorityProviderConfig, AuthorityProviderAlgorithm.class);
     }
 }
diff --git a/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/main/java/org/apache/shardingsphere/authority/rule/AuthorityRule.java b/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/main/java/org/apache/shardingsphere/authority/rule/AuthorityRule.java
index e7a26c4c09d..b64b7bb9ee9 100644
--- a/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/main/java/org/apache/shardingsphere/authority/rule/AuthorityRule.java
+++ b/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/main/java/org/apache/shardingsphere/authority/rule/AuthorityRule.java
@@ -20,12 +20,11 @@ package org.apache.shardingsphere.authority.rule;
 import org.apache.shardingsphere.authority.config.AuthorityRuleConfiguration;
 import org.apache.shardingsphere.authority.model.ShardingSpherePrivileges;
 import org.apache.shardingsphere.authority.spi.AuthorityProviderAlgorithm;
-import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmFactory;
+import org.apache.shardingsphere.authority.spi.AuthorityProviderAlgorithmFactory;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import org.apache.shardingsphere.infra.metadata.user.Grantee;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
 import org.apache.shardingsphere.infra.rule.identifier.scope.GlobalRule;
-import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
 
 import java.util.Collection;
 import java.util.Map;
@@ -36,16 +35,12 @@ import java.util.Optional;
  */
 public final class AuthorityRule implements GlobalRule {
     
-    static {
-        ShardingSphereServiceLoader.register(AuthorityProviderAlgorithm.class);
-    }
-    
     private final AuthorityProviderAlgorithm provider;
     
     private final Collection<ShardingSphereUser> users;
     
     public AuthorityRule(final AuthorityRuleConfiguration config, final Map<String, ShardingSphereMetaData> metaDataMap) {
-        provider = ShardingSphereAlgorithmFactory.createAlgorithm(config.getProvider(), AuthorityProviderAlgorithm.class);
+        provider = AuthorityProviderAlgorithmFactory.newInstance(config.getProvider());
         provider.init(metaDataMap, config.getUsers());
         users = config.getUsers();
     }
diff --git a/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/test/java/org/apache/shardingsphere/authority/checker/AuthorityCheckerTest.java b/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/test/java/org/apache/shardingsphere/authority/checker/AuthorityCheckerTest.java
index ebb9b877f55..a1b4325d8ee 100644
--- a/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/test/java/org/apache/shardingsphere/authority/checker/AuthorityCheckerTest.java
+++ b/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/test/java/org/apache/shardingsphere/authority/checker/AuthorityCheckerTest.java
@@ -21,11 +21,10 @@ import org.apache.shardingsphere.authority.config.AuthorityRuleConfiguration;
 import org.apache.shardingsphere.authority.rule.AuthorityRule;
 import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
 import org.apache.shardingsphere.infra.executor.check.SQLChecker;
+import org.apache.shardingsphere.infra.executor.check.SQLCheckerFactory;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import org.apache.shardingsphere.infra.metadata.user.Grantee;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
-import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
-import org.apache.shardingsphere.spi.type.ordered.OrderedSPIRegistry;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.CreateTableStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.InsertStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
@@ -55,10 +54,6 @@ import static org.mockito.Mockito.when;
 @RunWith(MockitoJUnitRunner.class)
 public final class AuthorityCheckerTest {
     
-    static {
-        ShardingSphereServiceLoader.register(SQLChecker.class);
-    }
-    
     @Mock(answer = Answers.RETURNS_DEEP_STUBS)
     private ShardingSphereMetaData metaData;
     
@@ -70,7 +65,7 @@ public final class AuthorityCheckerTest {
         users.add(root);
         AuthorityRuleConfiguration ruleConfig = new AuthorityRuleConfiguration(users, new ShardingSphereAlgorithmConfiguration("ALL_PRIVILEGES_PERMITTED", new Properties()));
         AuthorityRule rule = new AuthorityRule(ruleConfig, Collections.emptyMap());
-        SQLChecker<AuthorityRule> sqlChecker = OrderedSPIRegistry.getRegisteredServices(SQLChecker.class, Collections.singleton(rule)).get(rule);
+        SQLChecker<AuthorityRule> sqlChecker = SQLCheckerFactory.newInstance(Collections.singleton(rule)).get(rule);
         assertNotNull(sqlChecker);
         assertTrue(sqlChecker.check("db0", new Grantee("root", "localhost"), rule));
     }
@@ -83,7 +78,7 @@ public final class AuthorityCheckerTest {
         users.add(root);
         AuthorityRuleConfiguration ruleConfig = new AuthorityRuleConfiguration(users, new ShardingSphereAlgorithmConfiguration("NATIVE", new Properties()));
         AuthorityRule rule = new AuthorityRule(ruleConfig, createMetaDataMap(users));
-        SQLChecker<AuthorityRule> sqlChecker = OrderedSPIRegistry.getRegisteredServices(SQLChecker.class, Collections.singleton(rule)).get(rule);
+        SQLChecker<AuthorityRule> sqlChecker = SQLCheckerFactory.newInstance(Collections.singleton(rule)).get(rule);
         assertNotNull(sqlChecker);
         assertTrue(sqlChecker.check("db0", new Grantee("root", "localhost"), rule));
         assertFalse(sqlChecker.check("db1", new Grantee("root", "localhost"), rule));
@@ -98,7 +93,7 @@ public final class AuthorityCheckerTest {
         users.add(root);
         AuthorityRuleConfiguration ruleConfig = new AuthorityRuleConfiguration(users, new ShardingSphereAlgorithmConfiguration("NATIVE", new Properties()));
         AuthorityRule rule = new AuthorityRule(ruleConfig, Collections.emptyMap());
-        SQLChecker<AuthorityRule> sqlChecker = OrderedSPIRegistry.getRegisteredServices(SQLChecker.class, Collections.singleton(rule)).get(rule);
+        SQLChecker<AuthorityRule> sqlChecker = SQLCheckerFactory.newInstance(Collections.singleton(rule)).get(rule);
         assertNotNull(sqlChecker);
         assertTrue(sqlChecker.check(new Grantee("root", "localhost"), rule));
         assertFalse(sqlChecker.check(new Grantee("root", "192.168.0.1"), rule));
@@ -113,7 +108,7 @@ public final class AuthorityCheckerTest {
         users.add(root);
         AuthorityRuleConfiguration ruleConfig = new AuthorityRuleConfiguration(users, new ShardingSphereAlgorithmConfiguration("NATIVE", new Properties()));
         AuthorityRule rule = new AuthorityRule(ruleConfig, Collections.emptyMap());
-        SQLChecker<AuthorityRule> sqlChecker = OrderedSPIRegistry.getRegisteredServices(SQLChecker.class, Collections.singleton(rule)).get(rule);
+        SQLChecker<AuthorityRule> sqlChecker = SQLCheckerFactory.newInstance(Collections.singleton(rule)).get(rule);
         assertNotNull(sqlChecker);
         SelectStatement selectStatement = mock(SelectStatement.class);
         CreateTableStatement createTableStatement = mock(CreateTableStatement.class);
diff --git a/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/test/java/org/apache/shardingsphere/authority/provider/natived/NativeAuthorityProviderAlgorithmTest.java b/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/test/java/org/apache/shardingsphere/authority/provider/natived/NativeAuthorityProviderAlgorithmTest.java
index 827d7db4a01..fbc18aed2ca 100644
--- a/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/test/java/org/apache/shardingsphere/authority/provider/natived/NativeAuthorityProviderAlgorithmTest.java
+++ b/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-core/src/test/java/org/apache/shardingsphere/authority/provider/natived/NativeAuthorityProviderAlgorithmTest.java
@@ -19,13 +19,9 @@ package org.apache.shardingsphere.authority.provider.natived;
 
 import org.apache.shardingsphere.authority.model.PrivilegeType;
 import org.apache.shardingsphere.authority.model.ShardingSpherePrivileges;
-import org.apache.shardingsphere.authority.spi.AuthorityProviderAlgorithm;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import org.apache.shardingsphere.infra.metadata.user.Grantee;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
-import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
-import org.apache.shardingsphere.spi.type.typed.TypedSPIRegistry;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
 import javax.sql.DataSource;
@@ -35,11 +31,8 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedList;
 import java.util.Optional;
-import java.util.Properties;
 import java.util.stream.Collectors;
 
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
@@ -47,18 +40,6 @@ import static org.mockito.Mockito.when;
 
 public final class NativeAuthorityProviderAlgorithmTest {
     
-    @BeforeClass
-    public static void setUp() {
-        ShardingSphereServiceLoader.register(AuthorityProviderAlgorithm.class);
-    }
-    
-    @Test
-    public void assertAlgorithmType() {
-        Optional<AuthorityProviderAlgorithm> algorithm = TypedSPIRegistry.findRegisteredService(AuthorityProviderAlgorithm.class, "NATIVE", new Properties());
-        assertTrue(algorithm.isPresent());
-        assertThat(algorithm.get().getType(), is("NATIVE"));
-    }
-    
     @Test
     public void assertFindPrivileges() throws SQLException {
         NativeAuthorityProviderAlgorithm algorithm = new NativeAuthorityProviderAlgorithm();
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/job/JobOperationType.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/job/JobOperationType.java
index 2a51aefb5d9..bb02d209927 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/job/JobOperationType.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/job/JobOperationType.java
@@ -22,6 +22,5 @@ package org.apache.shardingsphere.data.pipeline.api.job;
  */
 public enum JobOperationType {
     
-    INSERT, DELETE, UPDATE, SELECT,
-    SYSTEM_LOAD, CPU_USAGE,
+    INSERT, DELETE, UPDATE, SELECT, SYSTEM_LOAD, CPU_USAGE
 }
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/spi/ratelimit/JobRateLimitAlgorithm.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/spi/ratelimit/JobRateLimitAlgorithm.java
index d0df9a55837..ee144fee4be 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/spi/ratelimit/JobRateLimitAlgorithm.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/spi/ratelimit/JobRateLimitAlgorithm.java
@@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithm;
 import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmPostProcessor;
 
 /**
- * Job rate limit algorithm, SPI.
+ * Job rate limit algorithm.
  */
 public interface JobRateLimitAlgorithm extends ShardingSphereAlgorithm, ShardingSphereAlgorithmPostProcessor {
     
diff --git a/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/listener/ContextManagerLifecycleListenerFactory.java
similarity index 58%
copy from shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java
copy to shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/listener/ContextManagerLifecycleListenerFactory.java
index bcb9136a09f..cb7030200ee 100644
--- a/shardingsphere-infra/shardingsphere-infra-merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/ResultProcessEngineFactory.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/listener/ContextManagerLifecycleListenerFactory.java
@@ -15,35 +15,30 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.merge.engine;
+package org.apache.shardingsphere.mode.manager.listener;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
-import org.apache.shardingsphere.spi.type.ordered.OrderedSPIRegistry;
 
 import java.util.Collection;
-import java.util.Map;
 
 /**
- * Result process engine factory.
+ * Context manager lifecycle listener factory.
  */
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ResultProcessEngineFactory {
+public final class ContextManagerLifecycleListenerFactory {
     
     static {
-        ShardingSphereServiceLoader.register(ResultProcessEngine.class);
+        ShardingSphereServiceLoader.register(ContextManagerLifecycleListener.class);
     }
     
     /**
-     * Create new instance of result process engine.
+     * Create new instances of context manager lifecycle listener.
      * 
-     * @param rules ShardingSphere rules
-     * @return new instance of result process engine
+     * @return new instances of context manager lifecycle listener
      */
-    @SuppressWarnings("rawtypes")
-    public static Map<ShardingSphereRule, ResultProcessEngine> newInstance(final Collection<ShardingSphereRule> rules) {
-        return OrderedSPIRegistry.getRegisteredServices(ResultProcessEngine.class, rules);
+    public static Collection<ContextManagerLifecycleListener> newInstances() {
+        return ShardingSphereServiceLoader.getServiceInstances(ContextManagerLifecycleListener.class);
     }
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/information/SelectInformationExecutorTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/information/SelectInformationExecutorTest.java
index 3bc02e5d90d..ddb9dd1ba0d 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/information/SelectInformationExecutorTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/executor/information/SelectInformationExecutorTest.java
@@ -21,7 +21,6 @@ import com.zaxxer.hikari.pool.HikariProxyResultSet;
 import org.apache.shardingsphere.authority.rule.AuthorityRule;
 import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
 import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
-import org.apache.shardingsphere.infra.executor.check.SQLChecker;
 import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
 import org.apache.shardingsphere.infra.federation.optimizer.context.OptimizerContext;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
@@ -40,7 +39,6 @@ import org.apache.shardingsphere.parser.rule.builder.DefaultSQLParserRuleConfigu
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
 import org.apache.shardingsphere.proxy.backend.text.admin.executor.AbstractDatabaseMetadataExecutor.DefaultDatabaseMetadataExecutor;
-import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
 import org.junit.Before;
@@ -72,10 +70,6 @@ import static org.mockito.Mockito.when;
 @RunWith(MockitoJUnitRunner.class)
 public final class SelectInformationExecutorTest {
     
-    static {
-        ShardingSphereServiceLoader.register(SQLChecker.class);
-    }
-    
     private static final ResultSet RESULT_SET = mock(HikariProxyResultSet.class);
     
     private final ParserConfiguration parserConfig = new SQLParserRule(new DefaultSQLParserRuleConfigurationBuilder().build()).toParserConfiguration();
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 6d87e2176af..0bf41385515 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
@@ -27,15 +27,14 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.mode.manager.ContextManagerBuilderFactory;
 import org.apache.shardingsphere.mode.manager.ContextManagerBuilderParameter;
 import org.apache.shardingsphere.mode.manager.listener.ContextManagerLifecycleListener;
+import org.apache.shardingsphere.mode.manager.listener.ContextManagerLifecycleListenerFactory;
 import org.apache.shardingsphere.proxy.backend.config.ProxyConfiguration;
 import org.apache.shardingsphere.proxy.backend.config.YamlProxyConfiguration;
 import org.apache.shardingsphere.proxy.backend.config.yaml.swapper.YamlProxyConfigurationSwapper;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import org.apache.shardingsphere.proxy.version.ShardingSphereProxyVersion;
-import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
 
 import java.sql.SQLException;
-import java.util.Collection;
 
 /**
  * Bootstrap initializer.
@@ -44,10 +43,6 @@ import java.util.Collection;
 @Slf4j
 public final class BootstrapInitializer {
     
-    static {
-        ShardingSphereServiceLoader.register(ContextManagerLifecycleListener.class);
-    }
-    
     /**
      * Initialize.
      *
@@ -76,8 +71,7 @@ public final class BootstrapInitializer {
     }
     
     private void contextManagerInitializedCallback(final ModeConfiguration modeConfig, final ContextManager contextManager) {
-        Collection<ContextManagerLifecycleListener> listeners = ShardingSphereServiceLoader.getServiceInstances(ContextManagerLifecycleListener.class);
-        for (ContextManagerLifecycleListener each : listeners) {
+        for (ContextManagerLifecycleListener each : ContextManagerLifecycleListenerFactory.newInstances()) {
             try {
                 each.onInitialized(modeConfig, contextManager);
                 // CHECKSTYLE:OFF
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandlerTest.java
index 122011c1d7e..51f7f1dde7f 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationHandlerTest.java
@@ -28,19 +28,17 @@ import org.apache.shardingsphere.db.protocol.mysql.constant.MySQLServerErrorCode
 import org.apache.shardingsphere.db.protocol.mysql.packet.handshake.MySQLAuthPluginData;
 import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
 import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
-import org.apache.shardingsphere.infra.executor.check.SQLChecker;
 import org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine;
+import org.apache.shardingsphere.infra.federation.optimizer.context.OptimizerContext;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;
 import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
-import org.apache.shardingsphere.infra.federation.optimizer.context.OptimizerContext;
 import org.apache.shardingsphere.mode.manager.ContextManager;
 import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
 import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
 import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
 import org.apache.shardingsphere.proxy.frontend.mysql.authentication.authenticator.MySQLAuthenticator;
 import org.apache.shardingsphere.proxy.frontend.mysql.authentication.authenticator.MySQLNativePasswordAuthenticator;
-import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -72,10 +70,6 @@ public final class MySQLAuthenticationHandlerTest {
     
     private final byte[] part2 = {83, 121, 75, 81, 87, 56, 120, 112, 73, 109, 77, 69};
     
-    static {
-        ShardingSphereServiceLoader.register(SQLChecker.class);
-    }
-    
     @Before
     public void setUp() {
         initAuthPluginDataForAuthenticationHandler();