You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/08/06 06:17:28 UTC

[GitHub] [shardingsphere] dachuan9e opened a new pull request #11678: Refactor proxy frontend start

dachuan9e opened a new pull request #11678:
URL: https://github.com/apache/shardingsphere/pull/11678


   Changes proposed in this pull request:
   
   - Refactor proxy frontend start
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu merged pull request #11678: Refactor proxy init and start

Posted by GitBox <gi...@apache.org>.
terrymanu merged pull request #11678:
URL: https://github.com/apache/shardingsphere/pull/11678


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] codecov-commenter commented on pull request #11678: Refactor proxy frontend start

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #11678:
URL: https://github.com/apache/shardingsphere/pull/11678#issuecomment-894069895


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11678?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#11678](https://codecov.io/gh/apache/shardingsphere/pull/11678?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (bb43d6c) into [master](https://codecov.io/gh/apache/shardingsphere/commit/89f2641b238af8a88425f50ed40077d236a77049?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (89f2641) will **decrease** coverage by `0.05%`.
   > The diff coverage is `0.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/11678/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/11678?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #11678      +/-   ##
   ============================================
   - Coverage     63.80%   63.75%   -0.06%     
     Complexity     1121     1121              
   ============================================
     Files          2254     2265      +11     
     Lines         34478    34614     +136     
     Branches       6019     6029      +10     
   ============================================
   + Hits          22000    22069      +69     
   - Misses        10706    10771      +65     
   - Partials       1772     1774       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/11678?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...trics/prometheus/collector/ProxyInfoCollector.java](https://codecov.io/gh/apache/shardingsphere/pull/11678/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtcGx1Z2lucy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1wbHVnaW4tbWV0cmljcy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1tZXRyaWNzLXByb21ldGhldXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2FnZW50L21ldHJpY3MvcHJvbWV0aGV1cy9jb2xsZWN0b3IvUHJveHlJbmZvQ29sbGVjdG9yLmphdmE=) | `80.00% <ø> (+8.57%)` | :arrow_up: |
   | [...dingsphere/proxy/frontend/ShardingSphereProxy.java](https://codecov.io/gh/apache/shardingsphere/pull/11678/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktZnJvbnRlbmQvc2hhcmRpbmdzcGhlcmUtcHJveHktZnJvbnRlbmQtY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvZnJvbnRlbmQvU2hhcmRpbmdTcGhlcmVQcm94eS5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...ce/core/yaml/pojo/YamlGovernanceConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/11678/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2dvdmVybmFuY2UvY29yZS95YW1sL3Bvam8vWWFtbEdvdmVybmFuY2VDb25maWd1cmF0aW9uLmphdmE=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [.../apache/shardingsphere/shadow/rule/ShadowRule.java](https://codecov.io/gh/apache/shardingsphere/pull/11678/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvcnVsZS9TaGFkb3dSdWxlLmphdmE=) | `34.37% <0.00%> (-20.18%)` | :arrow_down: |
   | [...ml/swapper/ShadowRuleConfigurationYamlSwapper.java](https://codecov.io/gh/apache/shardingsphere/pull/11678/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cveWFtbC9zd2FwcGVyL1NoYWRvd1J1bGVDb25maWd1cmF0aW9uWWFtbFN3YXBwZXIuamF2YQ==) | `60.00% <0.00%> (-10.00%)` | :arrow_down: |
   | [...itializer/impl/GovernanceBootstrapInitializer.java](https://codecov.io/gh/apache/shardingsphere/pull/11678/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYm9vdHN0cmFwL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9wcm94eS9pbml0aWFsaXplci9pbXBsL0dvdmVybmFuY2VCb290c3RyYXBJbml0aWFsaXplci5qYXZh) | `25.00% <0.00%> (-4.42%)` | :arrow_down: |
   | [...ava/org/apache/shardingsphere/proxy/Bootstrap.java](https://codecov.io/gh/apache/shardingsphere/pull/11678/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYm9vdHN0cmFwL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9wcm94eS9Cb290c3RyYXAuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...infra/rule/builder/ShardingSphereRulesBuilder.java](https://codecov.io/gh/apache/shardingsphere/pull/11678/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9ydWxlL2J1aWxkZXIvU2hhcmRpbmdTcGhlcmVSdWxlc0J1aWxkZXIuamF2YQ==) | `58.82% <0.00%> (ø)` | |
   | [...roxy/config/yaml/YamlProxyServerConfiguration.java](https://codecov.io/gh/apache/shardingsphere/pull/11678/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9wcm94eS9jb25maWcveWFtbC9ZYW1sUHJveHlTZXJ2ZXJDb25maWd1cmF0aW9uLmphdmE=) | `100.00% <0.00%> (ø)` | |
   | [...initializer/impl/StandardBootstrapInitializer.java](https://codecov.io/gh/apache/shardingsphere/pull/11678/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYm9vdHN0cmFwL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9wcm94eS9pbml0aWFsaXplci9pbXBsL1N0YW5kYXJkQm9vdHN0cmFwSW5pdGlhbGl6ZXIuamF2YQ==) | `57.14% <0.00%> (ø)` | |
   | ... and [20 more](https://codecov.io/gh/apache/shardingsphere/pull/11678/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11678?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11678?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [89f2641...bb43d6c](https://codecov.io/gh/apache/shardingsphere/pull/11678?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] terrymanu commented on a change in pull request #11678: Refactor proxy frontend start

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #11678:
URL: https://github.com/apache/shardingsphere/pull/11678#discussion_r684019376



##########
File path: shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/ShardingSphereProxy.java
##########
@@ -58,20 +54,28 @@
     @SneakyThrows(InterruptedException.class)
     public void start(final int port) {
         try {
-            createEventLoopGroup();
-            ServerBootstrap bootstrap = new ServerBootstrap();
-            initServerBootstrap(bootstrap);
-            ChannelFuture future = bootstrap.bind(port).sync();
-            startTime = new Date().getTime();
-            log.info("ShardingSphere-Proxy start success");
-            future.channel().closeFuture().sync();
+            ChannelFuture future = startInternal(port);
+            accept(future);
         } finally {
             workerGroup.shutdownGracefully();
             bossGroup.shutdownGracefully();
             BackendExecutorContext.getInstance().getExecutorEngine().close();
         }
     }
     
+    private ChannelFuture startInternal(final int port) throws InterruptedException {
+        createEventLoopGroup();
+        ServerBootstrap bootstrap = new ServerBootstrap();
+        initServerBootstrap(bootstrap);
+        ChannelFuture future = bootstrap.bind(port).sync();
+        return future;

Review comment:
       It is better to inline return expr




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] dachuan9e commented on a change in pull request #11678: Refactor proxy init and start

Posted by GitBox <gi...@apache.org>.
dachuan9e commented on a change in pull request #11678:
URL: https://github.com/apache/shardingsphere/pull/11678#discussion_r684026192



##########
File path: shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/ShardingSphereProxy.java
##########
@@ -58,20 +54,28 @@
     @SneakyThrows(InterruptedException.class)
     public void start(final int port) {
         try {
-            createEventLoopGroup();
-            ServerBootstrap bootstrap = new ServerBootstrap();
-            initServerBootstrap(bootstrap);
-            ChannelFuture future = bootstrap.bind(port).sync();
-            startTime = new Date().getTime();
-            log.info("ShardingSphere-Proxy start success");
-            future.channel().closeFuture().sync();
+            ChannelFuture future = startInternal(port);
+            accept(future);
         } finally {
             workerGroup.shutdownGracefully();
             bossGroup.shutdownGracefully();
             BackendExecutorContext.getInstance().getExecutorEngine().close();
         }
     }
     
+    private ChannelFuture startInternal(final int port) throws InterruptedException {
+        createEventLoopGroup();
+        ServerBootstrap bootstrap = new ServerBootstrap();
+        initServerBootstrap(bootstrap);
+        ChannelFuture future = bootstrap.bind(port).sync();
+        return future;

Review comment:
       ok.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org