RFR: 8340182: Java HttpClient does not follow default retry limit of 3 retries

p-nima duke at openjdk.org
Wed Jun 4 13:16:18 UTC 2025


On Wed, 28 May 2025 14:07:37 GMT, Darragh Clarke <dclarke at openjdk.org> wrote:

>> test/jdk/java/net/httpclient/HttpClientRetryLimitTest.java line 52:
>> 
>>> 50: 
>>> 51:     private static final int DEFAULT_RETRY_LIMIT = 3;
>>> 52:     private final int retryLimit = Integer.getInteger("jdk.httpclient.auth.retrylimit", DEFAULT_RETRY_LIMIT);
>> 
>> Nit: This feels a bit confusing to me when reading it the first time, why not have a retry limit of 1 or 0 as a default and then specify if you want more retries in `@test`?
>> I think it might be a bit easier to read, but if you want to keep it, it's fine with me.
>
> This line is grabbing the value of the `jdk.httpclient.auth.retrylimit` system property, and if it hasn't been set then it defaults to 3. This is based on [AuthenticationFilter.java](https://github.com/openjdk/jdk/blob/e89aa7c712be8e576b640a123da52e7f4f5f9391/src/java.net.http/share/classes/jdk/internal/net/http/AuthenticationFilter.java#L57)

A comment has been added for it in cdf78127351df62193e0ec5a09851de1c32e16e2

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25490#discussion_r2114263430


More information about the net-dev mailing list