我们看你一下okhttp源码中Dispatcher.java这个类的enqueue异步请求方法
synchronized void enqueue(AsyncCall call) {
if (runningAsyncCalls.size() < maxRequests && runningCallsForHost(call) < maxRequestsPerHost) {
runningAsyncCalls.add(call);
executorService().execute(call);
} else {
readyAsyncCalls.add(call);
}
}
源码中runningAsyncCalls.size() < maxRequests && runningCallsForHost(call) < maxRequestsPerHost这句话做了很好的解释:running队列的大小小于maxRequests 这个值,默认是64,并且争对同一个Host请求的任务数量小于maxRequestsPerHost这个值,默认是5,此时会加入到running队列,否则加入到ready队列