-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Description
Hello,
Is the Java client supposed to be thread-safe?
If I look at the generated code, there is a section that is not threadsafe :
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}apiClient.getHttpClient() is a shared OkHttpCLient, and networkInterceptors is an ArrayList.
So multiple thread calling API methods could end up trying to concurrently modify this ArrayList.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.Denotes an issue or PR that has aged beyond stale and will be auto-closed.