Skip to content

Commit 06b2a3c

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 40b81b0 commit 06b2a3c

2 files changed

Lines changed: 46 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 bound transport-failure
11+
retries (default 1; set 0 to disable). See the README for retry semantics.
12+
**Behavior change:** previously, transient transport failures (connection
13+
reset, broken pipe, etc.) surfaced to callers immediately. They are now
14+
retried once by default; pass `.maxRetries(0)` to restore the prior
15+
behavior.
1016

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

README.md

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

111111
See the API documentation for more details.
112112

113+
### Connection pooling and transport retries ###
114+
115+
`WebServiceClient` reuses pooled HTTP connections for performance. Idle
116+
connections can be silently closed by load balancers or other
117+
intermediaries; when the next request reuses such a half-closed connection,
118+
the JDK reports the failure as a `Connection reset`, `Broken pipe`, or
119+
similar transport error.
120+
121+
To smooth over these intermittent failures, the SDK retries once by
122+
default. Most transport-level `IOException`s are retried; the SDK does
123+
**not** retry:
124+
125+
* **Timeouts** (`HttpTimeoutException`, including connect-phase timeouts).
126+
The SDK honors the timeouts you configure rather than extending them.
127+
* **Cancellation** (`InterruptedIOException`, or any interrupt observed
128+
before the request runs).
129+
* **Typically deterministic failures**`UnknownHostException`,
130+
`ConnectException`, `SSLHandshakeException`, `SSLPeerUnverifiedException`.
131+
Retrying these would just delay surfacing a config bug.
132+
133+
HTTP 4xx and 5xx responses are surfaced through the existing exception
134+
hierarchy and are never retried. Request bodies are replayable, so retried
135+
requests are byte-identical to the original.
136+
137+
You can change the retry budget via the builder:
138+
139+
```java
140+
WebServiceClient client = new WebServiceClient.Builder(6, "ABCD567890")
141+
.maxRetries(2) // up to two retries (three total attempts)
142+
.build();
143+
```
144+
145+
Set `.maxRetries(0)` to disable the retry entirely. Negative values throw
146+
`IllegalArgumentException`.
147+
148+
If you frequently see `Connection reset` errors, you can also reduce the
149+
JDK's keep-alive timeout via the system property
150+
`jdk.httpclient.keepalive.timeout` (in seconds) to evict pooled connections
151+
before any intermediary does so.
152+
113153
### Exceptions ###
114154

115155
Runtime exceptions:

0 commit comments

Comments
 (0)