We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
ArkService中的线程池由OkHttpClient的Dispatcher管理,但未配置最大线程数、单主机最大请求数等参数。如果请求量增加并且线程池未正确关闭,则可能导致线程池无限增长,增加内存使用量,并可能导致 OutOfMemoryError。 建议: 创建OkHttpClient时,显式设置Dispatcher参数如setMaxRequests、setMaxRequestsPerHost来控制线程池的大小。
public static OkHttpClient defaultApiKeyClient(String apiKey, Duration timeout) { Dispatcher dispatcher = new Dispatcher(); dispatcher.setMaxRequests("最大线程数"); dispatcher.setMaxRequestsPerHost("单主机最大请求数"); return new OkHttpClient.Builder() .addInterceptor(new AuthenticationInterceptor(apiKey)) .addInterceptor(new RequestIdInterceptor()) .connectionPool(new ConnectionPool(5, 1, TimeUnit.SECONDS)) .readTimeout(timeout.toMillis(), TimeUnit.MILLISECONDS).dispatcher(dispatcher) .build(); }
The text was updated successfully, but these errors were encountered:
目前已经调整示例中建议的方式,考虑到其他兼容性问题,默认的Client暂时未进行修改。 非常感谢你宝贵的建议。
Sorry, something went wrong.
由于该 issue 已闲置较长时间,我们将24H后暂时关闭。如果您仍有相关问题:
No branches or pull requests
ArkService中的线程池由OkHttpClient的Dispatcher管理,但未配置最大线程数、单主机最大请求数等参数。如果请求量增加并且线程池未正确关闭,则可能导致线程池无限增长,增加内存使用量,并可能导致 OutOfMemoryError。
建议:
创建OkHttpClient时,显式设置Dispatcher参数如setMaxRequests、setMaxRequestsPerHost来控制线程池的大小。
The text was updated successfully, but these errors were encountered: