![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
OKHttp 原理
文章平均质量分 82
KabunM
这个作者很懒,什么都没留下…
展开
-
okhttp 原理笔记四:Dispatcher
一、关键组成:1、private int maxRequests = 64 //总的最大请求数2、private int maxRequestsPerHost = 5; //单个服务器的最大请求数3、private @Nullable ExecutorService executorService; //线程池4、private final Deque<AsyncCall> readyAsyncCalls // 异步...原创 2022-05-06 17:38:19 · 413 阅读 · 0 评论 -
okhttp 原理笔记三:RealCall
RealCall 是哪里来的呢?故事的开始是从下面揭开的:okHttpClient.newCall(request).enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, R原创 2022-04-29 11:34:27 · 1038 阅读 · 0 评论 -
okhttp 原理笔记二:它是怎么拿到请求结果的?
就上一篇,我们知道,请求的结果是通过方法 getResponseWithInterceptorChain() 拿到的Response response = getResponseWithInterceptorChain();那么 getResponseWithInterceptorChain() 方法里面是怎么走的? Response getResponseWithInterceptorChain() throws IOException { // Build a full sta原创 2022-04-23 19:59:21 · 1929 阅读 · 1 评论 -
okhttp 原理笔记一:它是怎么发送请求的?
以下基于okp 3.14.9 版本的分析 //要提交的正文 String content = "我叫靓仔"; //定义正文的类型为json RequestBody body = RequestBody.create( MediaType.parse("application/json"), content); //构建成一个请求 Request request...原创 2022-04-23 00:56:18 · 2421 阅读 · 1 评论