-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Thread Safety #467
Comments
Generally the client library doesn't add a progress listener, so in general, the client is thread-safe if you use the basic methods. If you do add a progress listener, it's not thread-safe, both for the reason you mention and because the progress listeners will get attached to multiple requests. Indeed, the more I look at ProgressListener, the more I think it should be avoided... Unfortunately, this is generated code, and I think it would be a pretty significant change to move remove this from the generated code. The good news is this is a (mostly) internal method, and generally |
Thank you for your quick response. As you can see, a progress listener is always defined when the callback is defined if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
} As you say if it's generated code, I'll create an issue at swagger github instead. |
A similar issue we have been running into is that each async call causes an additional
the list of networkInterceptors grows unbounded in size, until eventually new async calls on e.g. CoreV1Api cause a StackOverflowError. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle rotten |
hi @mattnworb
the async method how to use? Best Wishes |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
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 :
apiClient.getHttpClient()
is a shared OkHttpCLient, andnetworkInterceptors
is an ArrayList.So multiple thread calling API methods could end up trying to concurrently modify this ArrayList.
The text was updated successfully, but these errors were encountered: