Specify client connect timeout in OncRpcClientBuilder; consume in OncRpcClient connect call. #117
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.
This change adds a withConnectTimeout method to the OncRpcClientBuilder, which populates two fields:
These fields are then passed into the OncRpcClient during build and stored there as final fields on the OncRpcClient. When connect() is called, these values are used. They default to the same values that connect() originally used - Long.MAX_VALUE, and TimeUnit.MILLISECONDS.
This change allows generated interfaces to use a user-specified connect timeout, defaulting to the original default values if not specified. Note the rpcgen code did not need to be modified for this, as it continues to use rpcClient.connect(), but internally, this method uses the builder-specified default values, or the original default values if no builder was used.
An additional constructor is added to facilitate passing the default connect timeout parameters, which makes it possible for non-builder-users to also specify the default connect timeout (though they may also pass those values to connect directly).
This change should be 100% backward compatible. Please also merge to 3.3, if you have nothing against doing so.
Signed-off-by: John Calcote [email protected]