OkHttp 2.0.0-RC1 uses ThreadPoolExecutor
defined in Dispatcher#getExecutorService
:
executorService = new ThreadPoolExecutor(
0, Integer.MAX_VALUE,
60, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(),
Util.threadFactory("OkHttp Dispatcher", false));`
which is essentially implementation of Executors#newFixedThreadPool
.
On the other hand Retrofit uses Executors.newCachedThreadPool
defined in Platform#defaultHttpExecutor
which boils down to:
executorService = new ThreadPoolExecutor(
0, Integer.MAX_VALUE,
60, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>(),
someThreadFactory);
Anyone has any ideas why OkHttp uses Executors#newFixedThreadPool
and Retrofit Executors#newCachedThreadPool
?