Skip to content

Commit 9aab603

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 1bb3dfa commit 9aab603

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ CHANGELOG
77
* Added `FAT_ZEBRA` to the `Payment.Processor` enum.
88
* Added `CLEAR` to the `TransactionReport.Tag` enum for use with the Report
99
Transaction API.
10+
* Added `WebServiceClient.Builder.maxRetries(int)` to configure transport-
11+
failure retry behavior. Defaults to 1 (one retry on transient transport
12+
errors such as connection reset, broken pipe, EOF, or closed channel).
13+
Set to 0 to disable. `HttpTimeoutException` (covering both request-phase
14+
and connect-phase timeouts), `InterruptedIOException`, and HTTP 4xx/5xx
15+
responses are never retried.
1016

1117
4.2.0 (2026-02-26)
1218
------------------

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,45 @@ exception will be thrown.
110110

111111
See the API documentation for more details.
112112

113+
### Connection pooling and transport retries ###
114+
115+
`WebServiceClient` is thread-safe and reuses a pooled `HttpClient` across
116+
requests. Idle connections in the pool can be silently closed by load
117+
balancers or other intermediaries. When the next request reuses one of these
118+
half-closed connections, the JDK reports the failure as a `Connection reset`,
119+
`Broken pipe`, or related transport `IOException`.
120+
121+
To smooth over these intermittent transport failures, the SDK retries once
122+
by default. Any transport-level `IOException` raised by the underlying HTTP
123+
send is retried, with two exceptions:
124+
125+
* `HttpTimeoutException` — a request-phase timeout. Connect-phase timeouts
126+
(`HttpConnectTimeoutException`) are also excluded because they extend
127+
`HttpTimeoutException`. The SDK honors the timeouts you configure.
128+
* `InterruptedIOException` — the calling thread was interrupted; the SDK
129+
honors the cancellation rather than override it.
130+
131+
HTTP 4xx and 5xx responses are not retried — they are returned as
132+
`HttpResponse` objects (not `IOException`s) and surfaced through the existing
133+
exception hierarchy. POST bodies are replayable, so retried requests are
134+
byte-identical to the original.
135+
136+
You can change the retry budget via the builder:
137+
138+
```java
139+
WebServiceClient client = new WebServiceClient.Builder(6, "ABCD567890")
140+
.maxRetries(2) // up to two retries (three total attempts)
141+
.build();
142+
```
143+
144+
Set `.maxRetries(0)` to disable the retry entirely. Negative values throw
145+
`IllegalArgumentException`.
146+
147+
If you frequently see `Connection reset` errors, you can also reduce the
148+
JDK's keep-alive timeout via the system property
149+
`jdk.httpclient.keepalive.timeout` (in seconds) to evict pooled connections
150+
before any intermediary does so.
151+
113152
### Exceptions ###
114153

115154
Runtime exceptions:

0 commit comments

Comments
 (0)