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 2020/10/02 14:42:07 UTC
[shardingsphere] branch master updated: Minor changes for variable
name (#7687)
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 3e42c32 Minor changes for variable name (#7687)
3e42c32 is described below
commit 3e42c325565183c342e0ff34ac047c7711164a0a
Author: Liang Zhang <te...@163.com>
AuthorDate: Fri Oct 2 22:35:22 2020 +0800
Minor changes for variable name (#7687)
* Update javadoc
* Update ShardingSphereServiceLoader
* Refactor SQLRouteEngine
---
.../infra/spi/ShardingSphereServiceLoader.java | 12 ++++++------
.../shardingsphere/infra/route/engine/SQLRouteEngine.java | 6 +++---
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/spi/ShardingSphereServiceLoader.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/spi/ShardingSphereServiceLoader.java
index 0810864..0db0337 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/spi/ShardingSphereServiceLoader.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/spi/ShardingSphereServiceLoader.java
@@ -35,16 +35,16 @@ import java.util.stream.Collectors;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class ShardingSphereServiceLoader {
- private static final Map<Class<?>, Collection<Class<?>>> SERVICE_MAP = new ConcurrentHashMap<>();
+ private static final Map<Class<?>, Collection<Class<?>>> SERVICES = new ConcurrentHashMap<>();
/**
- * Register SPI service into map for new instance.
+ * Register service.
*
- * @param service service type
+ * @param service service class
* @param <T> type of service
*/
public static <T> void register(final Class<T> service) {
- if (SERVICE_MAP.containsKey(service)) {
+ if (SERVICES.containsKey(service)) {
return;
}
for (T each : ServiceLoader.load(service)) {
@@ -53,7 +53,7 @@ public final class ShardingSphereServiceLoader {
}
private static <T> void registerServiceClass(final Class<T> service, final T instance) {
- Collection<Class<?>> serviceClasses = SERVICE_MAP.computeIfAbsent(service, unused -> new LinkedHashSet<>());
+ Collection<Class<?>> serviceClasses = SERVICES.computeIfAbsent(service, unused -> new LinkedHashSet<>());
serviceClasses.add(instance.getClass());
}
@@ -66,7 +66,7 @@ public final class ShardingSphereServiceLoader {
*/
@SuppressWarnings("unchecked")
public static <T> Collection<T> newServiceInstances(final Class<T> service) {
- return SERVICE_MAP.containsKey(service) ? SERVICE_MAP.get(service).stream().map(each -> (T) newServiceInstance(each)).collect(Collectors.toList()) : Collections.emptyList();
+ return SERVICES.containsKey(service) ? SERVICES.get(service).stream().map(each -> (T) newServiceInstance(each)).collect(Collectors.toList()) : Collections.emptyList();
}
private static Object newServiceInstance(final Class<?> clazz) {
diff --git a/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngine.java b/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngine.java
index 0d35d35..981263a 100644
--- a/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngine.java
+++ b/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngine.java
@@ -43,13 +43,13 @@ public final class SQLRouteEngine {
private final ConfigurationProperties props;
@SuppressWarnings("rawtypes")
- private final Map<ShardingSphereRule, SQLRouter> decorators;
+ private final Map<ShardingSphereRule, SQLRouter> routers;
private final SPIRoutingHook routingHook;
public SQLRouteEngine(final ConfigurationProperties props, final Collection<ShardingSphereRule> rules) {
this.props = props;
- decorators = OrderedSPIRegistry.getRegisteredServices(rules, SQLRouter.class);
+ routers = OrderedSPIRegistry.getRegisteredServices(rules, SQLRouter.class);
routingHook = new SPIRoutingHook();
}
@@ -76,7 +76,7 @@ public final class SQLRouteEngine {
@SuppressWarnings({"unchecked", "rawtypes"})
private RouteContext doRoute(final LogicSQL logicSQL) {
RouteContext result = null;
- for (Entry<ShardingSphereRule, SQLRouter> entry : decorators.entrySet()) {
+ for (Entry<ShardingSphereRule, SQLRouter> entry : routers.entrySet()) {
if (null == result) {
result = entry.getValue().createRouteContext(logicSQL, entry.getKey(), props);
} else {