@@ -110,6 +110,45 @@ 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+ ` 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
115154Runtime exceptions:
0 commit comments