You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2022/06/03 17:22:13 UTC

[GitHub] [incubator-shenyu] lahmXu opened a new pull request, #3482: [ISSUE #3406]

lahmXu opened a new pull request, #3482:
URL: https://github.com/apache/incubator-shenyu/pull/3482

   Task #3406 
   
   Make sure that:
   
   - [x] You have read the [contribution guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [x] You submit test cases (unit or integration tests) that back your changes.
   - [x] Your local test passed `mvn clean install -Dmaven.javadoc.skip=true`.
   


-- 
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@shenyu.apache.org

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


[GitHub] [incubator-shenyu] codecov-commenter commented on pull request #3482: [ISSUE #3406]

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #3482:
URL: https://github.com/apache/incubator-shenyu/pull/3482#issuecomment-1146207733

   # [Codecov](https://codecov.io/gh/apache/incubator-shenyu/pull/3482?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 [#3482](https://codecov.io/gh/apache/incubator-shenyu/pull/3482?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d3c1189) into [master](https://codecov.io/gh/apache/incubator-shenyu/commit/244e85f9fa9bc97eb6bfb70baaf2aa6c3b44e21c?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (244e85f) will **decrease** coverage by `0.56%`.
   > The diff coverage is `7.31%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3482      +/-   ##
   ============================================
   - Coverage     62.99%   62.43%   -0.57%     
   + Complexity     5536     5503      -33     
   ============================================
     Files           834      834              
     Lines         23101    23165      +64     
     Branches       2090     2094       +4     
   ============================================
   - Hits          14553    14462      -91     
   - Misses         7216     7356     +140     
   - Partials       1332     1347      +15     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-shenyu/pull/3482?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [.../common/dto/convert/plugin/SofaRegisterConfig.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3482/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-c2hlbnl1LWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hlbnl1L2NvbW1vbi9kdG8vY29udmVydC9wbHVnaW4vU29mYVJlZ2lzdGVyQ29uZmlnLmphdmE=) | `36.36% <5.88%> (-30.31%)` | :arrow_down: |
   | [...enyu/plugin/sofa/cache/ApplicationConfigCache.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3482/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-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLXNvZmEvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vc29mYS9jYWNoZS9BcHBsaWNhdGlvbkNvbmZpZ0NhY2hlLmphdmE=) | `25.68% <8.33%> (-5.71%)` | :arrow_down: |
   | [...plugin/logging/rocketmq/LoggingRocketMQPlugin.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3482/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-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLXJvY2tldG1xL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvcGx1Z2luL2xvZ2dpbmcvcm9ja2V0bXEvTG9nZ2luZ1JvY2tldE1RUGx1Z2luLmphdmE=) | `22.72% <0.00%> (-72.73%)` | :arrow_down: |
   | [...ache/shenyu/plugin/grpc/cache/GrpcClientCache.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3482/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-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWdycGMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vZ3JwYy9jYWNoZS9HcnBjQ2xpZW50Q2FjaGUuamF2YQ==) | `75.00% <0.00%> (-25.00%)` | :arrow_down: |
   | [...arter/netty/ShenyuNettyWebServerConfiguration.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3482/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-c2hlbnl1LXNwcmluZy1ib290LXN0YXJ0ZXIvc2hlbnl1LXNwcmluZy1ib290LXN0YXJ0ZXItZ2F0ZXdheS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hlbnl1L3NwcmluZ2Jvb3Qvc3RhcnRlci9uZXR0eS9TaGVueXVOZXR0eVdlYlNlcnZlckNvbmZpZ3VyYXRpb24uamF2YQ==) | `23.68% <0.00%> (-23.69%)` | :arrow_down: |
   | [...ogging/rocketmq/body/LoggingServerHttpRequest.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3482/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-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWxvZ2dpbmcvc2hlbnl1LXBsdWdpbi1sb2dnaW5nLXJvY2tldG1xL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvcGx1Z2luL2xvZ2dpbmcvcm9ja2V0bXEvYm9keS9Mb2dnaW5nU2VydmVySHR0cFJlcXVlc3QuamF2YQ==) | `0.00% <0.00%> (-20.00%)` | :arrow_down: |
   | [...che/shenyu/sync/data/http/HttpSyncDataService.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3482/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-c2hlbnl1LXN5bmMtZGF0YS1jZW50ZXIvc2hlbnl1LXN5bmMtZGF0YS1odHRwL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvc3luYy9kYXRhL2h0dHAvSHR0cFN5bmNEYXRhU2VydmljZS5qYXZh) | `68.29% <0.00%> (-15.45%)` | :arrow_down: |
   | [...yu/sync/data/http/refresh/AbstractDataRefresh.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3482/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-c2hlbnl1LXN5bmMtZGF0YS1jZW50ZXIvc2hlbnl1LXN5bmMtZGF0YS1odHRwL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvc3luYy9kYXRhL2h0dHAvcmVmcmVzaC9BYnN0cmFjdERhdGFSZWZyZXNoLmphdmE=) | `70.00% <0.00%> (-13.34%)` | :arrow_down: |
   | [...a/org/apache/shenyu/common/utils/VersionUtils.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3482/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-c2hlbnl1LWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hlbnl1L2NvbW1vbi91dGlscy9WZXJzaW9uVXRpbHMuamF2YQ==) | `67.85% <0.00%> (-10.72%)` | :arrow_down: |
   | [...henyu/plugin/grpc/resolver/ShenyuNameResolver.java](https://codecov.io/gh/apache/incubator-shenyu/pull/3482/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-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWdycGMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vZ3JwYy9yZXNvbHZlci9TaGVueXVOYW1lUmVzb2x2ZXIuamF2YQ==) | `54.25% <0.00%> (-9.58%)` | :arrow_down: |
   | ... and [42 more](https://codecov.io/gh/apache/incubator-shenyu/pull/3482/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/incubator-shenyu/pull/3482?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/incubator-shenyu/pull/3482?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 [244e85f...d3c1189](https://codecov.io/gh/apache/incubator-shenyu/pull/3482?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@shenyu.apache.org

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


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3482: [ISSUE #3406] Sofa and tars using shared thread pool.

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3482:
URL: https://github.com/apache/incubator-shenyu/pull/3482#discussion_r889451087


##########
db/upgrade/2.4.3-upgrade-2.5.0-mysql.sql:
##########
@@ -35,6 +35,7 @@ INSERT IGNORE INTO plugin_handle (`id`, `plugin_id`, `field`, `label`, `data_typ
 -- insert dict for all plugin
 INSERT IGNORE INTO shenyu_dict (`id`, `type`, `dict_code`, `dict_name`, `dict_value`, `desc`, `sort`, `enabled`) VALUES ('1516043399649357824', 'operator', 'OPERATOR', 'startsWith', 'startsWith', 'startsWith', 7, 1);
 INSERT IGNORE INTO shenyu_dict (`id`, `type`, `dict_code`, `dict_name`, `dict_value`, `desc`, `sort`, `enabled`) VALUES ('1516043495265869824', 'operator', 'OPERATOR', 'endsWith', 'endsWith', 'endsWith', 8, 1);
+INSERT IGNORE INTO `shenyu_dict` VALUES ('1529402613195784246', 'threadpool', 'THREADPOOL', 'default', 'default', '', 5, 1, '2022-05-25 18:02:53', '2022-05-25 18:02:53');

Review Comment:
   Complete table field declaration, just like line 37.



-- 
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@shenyu.apache.org

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


[GitHub] [incubator-shenyu] dragon-zhang merged pull request #3482: [ISSUE #3406] Sofa and tars using shared thread pool.

Posted by GitBox <gi...@apache.org>.
dragon-zhang merged PR #3482:
URL: https://github.com/apache/incubator-shenyu/pull/3482


-- 
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@shenyu.apache.org

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


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3482: [ISSUE #3406] Sofa and tars using shared thread pool.

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3482:
URL: https://github.com/apache/incubator-shenyu/pull/3482#discussion_r889452521


##########
shenyu-plugin/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/cache/ApplicationConfigCache.java:
##########
@@ -146,12 +145,25 @@ private void initThreadPool(final TarsRegisterConfig config) {
             case Constants.LIMITED:
                 throw new UnsupportedOperationException();
             case Constants.CACHED:
-            default:
                 int corePoolSize = Optional.ofNullable(config.getCorethreads()).orElse(0);
                 int maximumPoolSize = Optional.ofNullable(config.getThreads()).orElse(Integer.MAX_VALUE);
                 int queueSize = Optional.ofNullable(config.getQueues()).orElse(0);
                 threadPool = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, 60L, TimeUnit.SECONDS,
                         queueSize > 0 ? new LinkedBlockingQueue<>(queueSize) : new SynchronousQueue<>(), factory);
+                return;
+            default:
+                return;
+        }
+    }
+
+    /**
+     * Set communicator thread pool.
+     */
+    private void setCommunicatorThreadPool() {
+        if (Objects.nonNull(threadPool)) {
+            Field field = ReflectionUtils.findField(Communicator.class, "threadPoolExecutor");

Review Comment:
   Using java.util.Optional to add null judgment.



-- 
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@shenyu.apache.org

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


[GitHub] [incubator-shenyu] dragon-zhang commented on a diff in pull request #3482: [ISSUE #3406] Sofa and tars using shared thread pool.

Posted by GitBox <gi...@apache.org>.
dragon-zhang commented on code in PR #3482:
URL: https://github.com/apache/incubator-shenyu/pull/3482#discussion_r889450777


##########
shenyu-plugin/shenyu-plugin-sofa/src/main/java/org/apache/shenyu/plugin/sofa/cache/ApplicationConfigCache.java:
##########
@@ -108,6 +123,52 @@ public void init(final SofaRegisterConfig sofaRegisterConfig) {
             registryConfig.setRegister(false);
             registryConfig.setAddress(sofaRegisterConfig.getRegister());
         }
+        if (StringUtils.isNotBlank(sofaRegisterConfig.getThreadpool())) {
+            initThreadPool(sofaRegisterConfig);
+            setAsyncRuntimeThreadPool();
+        }
+    }
+
+    /**
+     * Set sofa asyncRuntime thread pool.
+     */
+    private void setAsyncRuntimeThreadPool() {
+        if (Objects.nonNull(threadPool)) {
+            Field field = ReflectionUtils.findField(AsyncRuntime.class, "asyncThreadPool");
+            ReflectionUtils.makeAccessible(field);

Review Comment:
   Using `java.util.Optional` to add null judgment.



-- 
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@shenyu.apache.org

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