英文:
Okhttp3 needs to make unquie properties value like readtimeout for one object
问题
在okhttp3中,诸如readtimeout值之类的属性值会针对每个连接更改,但工厂对象将是单例的。
当两个线程同时建立连接时,它会覆盖readtimeout值吗?
英文:
In okhttp3 the properties value like readtimeout value will be changed for each but the factory object will be singleton.
Does it override the readtimeout value when two thread makes connection at same time
答案1
得分: 1
每个OkHttpClient实例都是独立的,可以安全地并发使用。如果您想在OkHttpClient实例之间共享资源,请使用newBuilder()
创建一个构建器,该构建器与另一个实例共享所有内容。
英文:
Each instance of OkHttpClient is independent and safe for concurrent use. If you want to share resources between OkHttpClient instances, use newBuilder()
to make a builder that shares everything with another instance.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论