Skip to content

JDK HTTP Client: Implement retry handling for 429/503 status codes and certain IOExceptions #1732

@kwin

Description

@kwin

New feature, improvement proposal

According to https://the-asf.slack.com/archives/C7Q9JB404/p1767710058223369?thread_ts=1767696574.875419&cid=C7Q9JB404

429 is used for rate limiting

(refers to Maven Central GET requests).
Therefore a retry handling should be properly implemented for Java HTTP client transport according to https://www.rfc-editor.org/rfc/rfc6585#section-4 (evaluating the optional Retry-After response header).

This is already implemented for Apache HTTP Client in

private static class ResolverServiceUnavailableRetryStrategy implements ServiceUnavailableRetryStrategy {
.

Apart from that certain IOException should be retried in the same way as in https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java#L102

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions