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 29b2dbd  Refactor BootstrapInitializer (#12828)
29b2dbd is described below

commit 29b2dbd0fc882724564bd4f48c268a36098726c7
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Sep 29 23:51:26 2021 +0800

    Refactor BootstrapInitializer (#12828)
---
 .../apache/shardingsphere/proxy/initializer/BootstrapInitializer.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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 2407aaa..d8894a9 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
@@ -106,8 +106,8 @@ public final class BootstrapInitializer {
     
     private Optional<DataSource> findBackendDataSource() {
         MetaDataContexts metaDataContexts = 
ProxyContext.getInstance().getContextManager().getMetaDataContexts();
-        Optional<ShardingSphereMetaData> metaDataOptional = 
metaDataContexts.getMetaDataMap().values().stream().filter(ShardingSphereMetaData::isComplete).findFirst();
-        return metaDataOptional.flatMap(shardingSphereMetaData -> 
shardingSphereMetaData.getResource().getDataSources().values().stream().findFirst());
+        Optional<ShardingSphereMetaData> metaData = 
metaDataContexts.getMetaDataMap().values().stream().filter(ShardingSphereMetaData::isComplete).findFirst();
+        return metaData.flatMap(optional -> 
optional.getResource().getDataSources().values().stream().findFirst());
     }
     
     private void initScaling(final YamlProxyConfiguration yamlConfig, final 
ModeConfiguration modeConfig) {

Reply via email to