Skip to content

Commit a517511

Browse files
oschwaldclaude
andcommitted
STF-322: Document transport-failure retry in README and CHANGELOG
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 28c937b commit a517511

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
CHANGELOG
22
=========
33

4+
5.0.3 (unreleased)
5+
------------------
6+
7+
* Added `WebServiceClient.Builder.maxRetries(int)` to bound transport-failure
8+
retries (default 1; set 0 to disable). See the README for retry semantics.
9+
**Behavior change:** previously, transient transport failures (connection
10+
reset, broken pipe, etc.) surfaced to callers immediately. They are now
11+
retried once by default; pass `.maxRetries(0)` to restore the prior
12+
behavior.
13+
414
5.0.2 (2025-12-08)
515
------------------
616

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,46 @@ are not created for each request.
7272
See the [API documentation](https://maxmind.github.io/GeoIP2-java/) for
7373
more details.
7474

75+
### Connection pooling and transport retries ###
76+
77+
`WebServiceClient` reuses pooled HTTP connections for performance. Idle
78+
connections can be silently closed by load balancers or other
79+
intermediaries; when the next request reuses such a half-closed connection,
80+
the JDK reports the failure as a `Connection reset`, `Broken pipe`, or
81+
similar transport error.
82+
83+
To smooth over these intermittent failures, the SDK retries once by
84+
default. Most transport-level `IOException`s are retried; the SDK does
85+
**not** retry:
86+
87+
* **Timeouts** (`HttpTimeoutException`, including connect-phase timeouts).
88+
The SDK honors the timeouts you configure rather than extending them.
89+
* **Cancellation** (`InterruptedIOException`, or any interrupt observed
90+
before the request runs).
91+
* **Typically deterministic failures**`UnknownHostException`,
92+
`ConnectException`, `SSLHandshakeException`, `SSLPeerUnverifiedException`.
93+
Retrying these would just delay surfacing a config bug.
94+
95+
HTTP 4xx and 5xx responses are surfaced through the existing exception
96+
hierarchy and are never retried. Request bodies are replayable, so retried
97+
requests are byte-identical to the original.
98+
99+
You can change the retry budget via the builder:
100+
101+
```java
102+
WebServiceClient client = new WebServiceClient.Builder(42, "license_key")
103+
.maxRetries(2) // up to two retries (three total attempts)
104+
.build();
105+
```
106+
107+
Set `.maxRetries(0)` to disable the retry entirely. Negative values throw
108+
`IllegalArgumentException`.
109+
110+
If you frequently see `Connection reset` errors, you can also reduce the
111+
JDK's keep-alive timeout via the system property
112+
`jdk.httpclient.keepalive.timeout` (in seconds) to evict pooled connections
113+
before any intermediary does so.
114+
75115
## Web Service Example ##
76116

77117
### Country Service ###

0 commit comments

Comments
 (0)