jt2594838 commented on PR #9667: URL: https://github.com/apache/iotdb/pull/9667#issuecomment-1547275222
> Fantastic job, only minor question, why not just using thread pool like this `ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory)` rather than recreate the DynamicThread? The keep-alive mechanism in ThreadPoolExecutor is very primitive. It: 1. destroys threads that are not active within the keepAliveTime, not concerning the idle ratio. 2. adds new threads whenever there is a pending task and the thread number does not reach the maximum size, not concerning the idle ratio. 3. does not apply to our situation, where each thread runs an infinite loop. As a result, the thread is always alive and will never be destroyed. Based on such features, ThreadPoolExecutor cannot control the utility of threads at a finer level, which is the motivation we create DynamicThread. -- 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]
