wujimin commented on a change in pull request #1161: [SCB-1232] make 
GroupExecutor configuration compatible to old version
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/1161#discussion_r270739279
 
 

 ##########
 File path: 
core/src/test/java/org/apache/servicecomb/core/executor/TestGroupExecutor.java
 ##########
 @@ -86,46 +75,83 @@ public void maxQueueSize() {
   }
 
   @Test
-  public void maxThreads() {
+  public void threads_allDefault() {
     groupExecutor.initConfig();
+    Assert.assertEquals(100, groupExecutor.coreThreads);
     Assert.assertEquals(100, groupExecutor.maxThreads);
+  }
+
+  @Test
+  public void threads_compatible() {
+    ArchaiusUtils.setProperty(GroupExecutor.KEY_OLD_THREAD, 200);
 
-    LogCollector collector = new LogCollector();
-    ArchaiusUtils.setProperty(GroupExecutor.KEY_THREAD, 200);
     groupExecutor.initConfig();
+    Assert.assertEquals(200, groupExecutor.coreThreads);
     Assert.assertEquals(200, groupExecutor.maxThreads);
-    Assert.assertEquals(
-        "servicecomb.executor.default.thread-per-group is deprecated, 
recommended to use servicecomb.executor.default.maxThreads-per-group.",
-        collector.getEvents().get(collector.getEvents().size() - 
2).getMessage());
-    collector.teardown();
+  }
+
+  @Test
+  public void threads_standard() {
+    ArchaiusUtils.setProperty(GroupExecutor.KEY_CORE_THREADS, 25);
+    ArchaiusUtils.setProperty(GroupExecutor.KEY_MAX_THREADS, 100);
 
-    ArchaiusUtils.setProperty(GroupExecutor.KEY_MAX_THREADS, 300);
     groupExecutor.initConfig();
-    Assert.assertEquals(300, groupExecutor.maxThreads);
+    Assert.assertEquals(25, groupExecutor.coreThreads);
+    Assert.assertEquals(100, groupExecutor.maxThreads);
   }
 
   @Test
-  public void adjustCoreThreads() {
+  public void threads_onlyMaxThread() {
     ArchaiusUtils.setProperty(GroupExecutor.KEY_MAX_THREADS, 10);
 
-    LogCollector collector = new LogCollector();
     groupExecutor.initConfig();
     Assert.assertEquals(10, groupExecutor.maxThreads);
-    Assert.assertEquals(
-        "coreThreads is bigger than maxThreads, change from 25 to 10.",
-        collector.getEvents().get(collector.getEvents().size() - 
2).getMessage());
-    collector.teardown();
+    Assert.assertEquals(10, groupExecutor.maxThreads);
 
 Review comment:
   because of jdk thread pool rule and compatible to old version
   
   if upgrade from old version, no queueSize configured, it will be max int, if 
queueSize is too big, then coreThreads different to maxThreads is no meaning
   but we can not know how big is "too big"
   
   if developers configured queueSize, we can only treat the developer know 
what happened, just use the existing value.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to