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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to