@@ -110,6 +110,41 @@ exception will be thrown.
110110
111111See 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
115150Runtime exceptions:
0 commit comments