There seems to be no method... Executors is just a thread pool tool class that uses factory methods. FixThreadPool, CachedThreadPool, etc. are all based on thread pools that handle a certain or special situation, so they do not support setting parameters. They can only Improve performance by monitoring the status of the computer to set different values; If you must dynamically scale, it is recommended to inherit the ThreadPoolExecutor class yourself, rewrite the beforeExecute, afterExecute, terminated methods, and use the set methods of coreSize, maxinumSize, and keepalivetime to make dynamic adjustments.
There seems to be no method... Executors is just a thread pool tool class that uses factory methods. FixThreadPool, CachedThreadPool, etc. are all based on thread pools that handle a certain or special situation, so they do not support setting parameters. They can only Improve performance by monitoring the status of the computer to set different values;
If you must dynamically scale, it is recommended to inherit the ThreadPoolExecutor class yourself, rewrite the beforeExecute, afterExecute, terminated methods, and use the set methods of coreSize, maxinumSize, and keepalivetime to make dynamic adjustments.