Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

okHttpClient 单例化 #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ruirui1128
Copy link

在有些项目中, 网络请求可能不止一个apiService,很有可能是多个api,如UserApiService, OrderApiService,BuyCartApiService,再Api单例化的时候,okHttpClient 会创建多个对象,影响性能。因此okHttpClient 需要单例化。当然在此项目中只有一个apiService,并没有此问题。

在有些项目中, 网络请求可能不止一个apiService,很有可能是多个api,如UserApiService, OrderApiService,BuyCartApiService,再Api单例化的时候,okHttpClient 会创建多个对象,影响性能。因此okHttpClient 需要单例化。当然在此项目中只有一个apiService,并没有此问题。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant