OkHttp 2.0.0-RC1 使用DispatcherThreadPoolExecutor中定义:#getExecutorService
executorService = new ThreadPoolExecutor(
0, Integer.MAX_VALUE,
60, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(),
Util.threadFactory("OkHttp Dispatcher", false));`
这本质上是Executors#newFixedThreadPool.
另一方面,平台Executors.newCachedThreadPool中定义的改造用途归结为:#defaultHttpExecutor
executorService = new ThreadPoolExecutor(
0, Integer.MAX_VALUE,
60, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>(),
someThreadFactory);
任何人都知道为什么 OkHttp 使用Executors#newFixedThreadPool和 Retrofit Executors#newCachedThreadPool?