aws-doc-sdk-examples icon indicating copy to clipboard operation
aws-doc-sdk-examples copied to clipboard

[Bug]: CLIENT_EXECUTION_TIMEOUT in the sample code of java 2.x misleads customers

Open runchengwang opened this issue 1 year ago • 0 comments

Expected behavior

please confirm if indeed the variable CLIENT_EXECUTION_TIMEOUT is no longer in use in java 2.x , and if so, whether there will be a deletion or adjustment of the sample code to achieve a similar effect as in 1.x (using ClientOverrideConfiguration.Builder's apiCallTimeout method).

Actual behavior

CLIENT_EXECUTION_TIMEOUT exist but not used.

Steps to reproduce

As referenced in the documentation at:
https://docs.amazonaws.cn/athena/latest/ug/code-samples.html#constants

The sample code defines CLIENT_EXECUTION_TIMEOUT. However, it has been confirmed that this variable, CLIENT_EXECUTION_TIMEOUT, is indeed not used in the 2.x sample code, but is utilized in the 1.x versions. Searching the code repository with the corresponding keyword confirms this:
https://github.com/search?q=repo%3Aawsdocs%2Faws-doc-sdk-examples+CLIENT_EXECUTION_TIMEOUT&type=code

In 1.x, the variable is set and used through ClientConfiguration().withClientExecutionTimeout():

https://github.com/awsdocs/aws-doc-sdk-examples/blob/d748b8b8b521322e9bc0b1bf9dc10e59b43aa52d/java/example_code/athena/src/main/java/aws/example/athena/AthenaClientFactory.java#L27

java

private final AmazonAthenaClientBuilder builder = AmazonAthenaClientBuilder.standard()
    .withRegion(Regions.US_WEST_2)
    .withCredentials(InstanceProfileCredentialsProvider.getInstance())
    .withClientConfiguration(
        new ClientConfiguration().withClientExecutionTimeout(ExampleConstants.CLIENT_EXECUTION_TIMEOUT));

public AmazonAthena createClient() {
  return builder.build();
}

In the 2.x versions, no usage was found (nor in other sample codes):
https://github.com/awsdocs/aws-doc-sdk-examples/blob/d748b8b8b521322e9bc0b1bf9dc10e59b43aa52d/javav2/example_code/athena/src/main/java/aws/example/athena/AthenaClientFactory.java

java

public class AthenaClientFactory {
    private final AthenaClientBuilder builder = AthenaClient.builder()
            .region(Region.US_WEST_2)
            .credentialsProvider(ProfileCredentialsProvider.create());

    public AthenaClient createClient() {
        return builder.build();
    }
}

Therefore, please confirm if indeed the variable is no longer in use, and if so, whether there will be a deletion or adjustment of the sample code to achieve a similar effect as in 1.x (using ClientOverrideConfiguration.Builder's apiCallTimeout method).
Thank you.

Logs / stacktrace (if applicable)

No response

Which SDK were you using?

Java (v2)

Which OS were you using?

macOS

SDK version

No response

OS version

No response

runchengwang avatar Mar 05 '24 13:03 runchengwang