dragon-zhang commented on pull request #9789:
URL: https://github.com/apache/dubbo/pull/9789#issuecomment-1067992962


   ```java
   public class FixedThreadPool implements ThreadPool {
   
       public static final String NAME = "fixed";
   
       @Override
       public Executor getExecutor(URL url) {
           String name = url.getParameter(THREAD_NAME_KEY, DEFAULT_THREAD_NAME);
           int threads = url.getParameter(THREADS_KEY, DEFAULT_THREADS);
           int queues = url.getParameter(QUEUES_KEY, DEFAULT_QUEUES);
           return new ThreadPoolExecutor(threads, threads, 0, 
TimeUnit.MILLISECONDS,
                   queues == 0 ? new SynchronousQueue<Runnable>() :
                           (queues < 0 ?
                                   //here can be replace to 
MemoryLimitedLinkedBlockingQueue
                                   //for example, limit the maximum memory used 
by this queue to 100MB
                                   new LinkedBlockingQueue<Runnable>()
                                   : new LinkedBlockingQueue<Runnable>(queues)),
                   new NamedInternalThreadFactory(name, true), new 
AbortPolicyWithReport(name, url));
       }
   
   }
   ```
   like `FixedThreadPool`, we should also change it in 
`CachedThreadPool`、`EagerThreadPool` and `LimitedThreadPool`.


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