- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用Executors.newCachedThreadPool()时,线程池中最初创建了多少个线程,Javadoc没有指定任何数字,是否有一个保证的数字,我们最初总是会得到10个之类的东西.以下文档:
newCachedThreadPool public static ExecutorService newCachedThreadPool() Creates a thread pool that creates new threads as needed, but will reuse previously constructed threads when they are available. These pools will typically improve the performance of programs that execute many short-lived asynchronous tasks. Calls to execute will reuse previously constructed threads if available. If no existing thread is available, a new thread will be created and added to the pool. Threads that have not been used for sixty seconds are terminated and removed from the cache. Thus, a pool that remains idle for long enough will not consume any resources. Note that pools with similar properties but different details (for example, timeout parameters) may be created using ThreadPoolExecutor constructors. Returns: the newly created thread pool
最佳答案
答案是0
。
您可以在 source code 中找到就在 ThreadPoolExecutor creation 之后有no workers spawned 。
关于java - 使用 Executors.newCachedThreadPool() 时在线程池中创建的线程数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39028735/
我是一名优秀的程序员,十分优秀!