Skip to content

Commit 9ba81a5

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 08fef7d commit 9ba81a5

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ 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-failure
11+
retry behavior. Defaults to 1 (one retry on connection reset, broken pipe,
12+
or connect timeout). Set to 0 to disable. Request-phase timeouts and HTTP
13+
4xx/5xx responses are never retried.
1014

1115
4.2.0 (2026-02-26)
1216
------------------

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,41 @@ 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+
(or `Broken pipe`) `IOException`.
120+
121+
To smooth over these intermittent transport failures, the SDK retries once by
122+
default. The retry covers:
123+
124+
* `SocketException` with message `Connection reset` or `Broken pipe`,
125+
* `ConnectException`,
126+
* `HttpConnectTimeoutException`.
127+
128+
Retries are **not** applied to request-phase timeouts (`HttpTimeoutException`)
129+
or to HTTP 4xx / 5xx responses. POST bodies are replayable, so retried
130+
requests are byte-identical to the original.
131+
132+
You can change the retry budget via the builder:
133+
134+
```java
135+
WebServiceClient client = new WebServiceClient.Builder(6, "ABCD567890")
136+
.maxRetries(2) // up to two retries (three total attempts)
137+
.build();
138+
```
139+
140+
Set `.maxRetries(0)` to disable the retry entirely. Negative values throw
141+
`IllegalArgumentException`.
142+
143+
If you frequently see `Connection reset` errors, you can also reduce the
144+
JDK's keep-alive timeout via the system property
145+
`jdk.httpclient.keepalive.timeout` (in seconds) to evict pooled connections
146+
before any intermediary does so.
147+
113148
### Exceptions ###
114149

115150
Runtime exceptions:

0 commit comments

Comments
 (0)