hanxueming126 opened a new issue #9276:
URL: https://github.com/apache/dubbo/issues/9276


   <!-- If you need to report a security issue please visit 
https://github.com/apache/dubbo/security/policy -->
   
   <!-- For all design discussions please continue. -->
   
我看Dubbo3的源码,在默认Dubbo协议下,同步调用返回线程的时候是在`AbstractInvoker`中,同步状态下返回的是一个`ThreadlessExecutor`:
   ```java
   protected ExecutorService getCallbackExecutor(URL url, Invocation inv) {
           ExecutorService sharedExecutor = 
ExtensionLoader.getExtensionLoader(ExecutorRepository.class)
                   .getDefaultExtension()
                   .getExecutor(url);
           if (InvokeMode.SYNC == RpcUtils.getInvokeMode(getUrl(), inv)) {
               return new ThreadlessExecutor(sharedExecutor);
           } else {
               return sharedExecutor;
           }
       }
   ```
   
而我看`AbstractInvoker`里面的源码,这个里面维护了一个`BlockingQueue`队列,如果我们调用execute执行任务的时候会判断当前是否等待,如果等待将任务加入到队列中去。但是这里是每次调用都会生成一个`ThreadlessExecutor`,不太明白这么做的目的。
   
   
   
   


-- 
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to