[fix][admin] Use ClientConfigurationData timeout params to set AsyncHttpConnector timeout params #25040
+209
−21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
In previous code, we use
client.getConfiguration().getProperty(ClientProperties.CONNECT_TIMEOUT)as PulsarAdmin'sconnectionTimeoutMs, useclient.getConfiguration().getProperty(ClientProperties.READ_TIMEOUT)as PulsarAdmin'sreadTimeoutMs, usePulsarAdminImpl.DEFAULT_REQUEST_TIMEOUT_SECONDS * 1000as PulsarAdmin'srequestTimeoutMs. See:pulsar/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java
Lines 121 to 128 in b71bea4
Before this PR, we can't tune
requestTimeoutMs, which is always 30000s = 5min. See also in:#24879 (comment)
Modifications
Now, we use
ClientConfigurationData.requestTimeoutMsasAsyncHttpConnector.requestTimeoutMs, so we can control the http retry timeout by tuningClientConfigurationData.requestTimeoutMs.AsyncHttpClient get Connector by calling
ConnectorProvider#getConnector(Client client, Configuration runtimeConfig)method.https://github.com/eclipse-ee4j/jersey/blob/bb8a2a1b78e39604f4d283d0176705b143355cce/core-client/src/main/java/org/glassfish/jersey/client/ClientConfig.java#L465-L467
Both
connectionTimeoutMsandreadTimeoutMsare the same values in jersey properties andClientConfigurationData. See:pulsar/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/PulsarAdminImpl.java
Lines 146 to 150 in b71bea4
To ensure code consistency, I would like to suggest using
ClientConfigurationDataand removing jersey config.Side effect: default
requestTimeoutMschanges from 30s to 60s after this PR, which I think is reasonable. If I didn't read the source code, I would assumerequestTimeoutMsis set to 60s, and it would confuse me to find thatrequestTimeoutMsdidn't take effect after I adjusted this value.Verifying this change
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: oneby-wang#11