You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The library provides configurable timeout settings on the `Config` object. These timeouts are applied consistently across all API calls (Checkout, Payments, Recurring, Terminal, etc.).
|`connectionTimeoutMillis`| 60000 ms | Maximum time to wait for a TCP connection (and TLS handshake) to be established with the server. If the server is unreachable or slow to accept connections, this timeout fires. |
356
+
|`readTimeoutMillis`| 60000 ms | Maximum time to wait for data on an already established connection (socket read timeout). This is the hard upper bound on how long any single API call can take once connected. |
357
+
|`connectionRequestTimeoutMillis`| 60000 ms | Maximum time to wait to lease a connection from the internal connection pool. Relevant under high concurrency when the pool is saturated. |
358
+
|`defaultKeepAliveMillis`| 60000 ms | Duration to keep idle connections alive for reuse. |
359
+
360
+
**Best practices:**
361
+
362
+
- Always set explicit timeouts for production environments. The 60-second defaults may be too high for latency-sensitive services.
363
+
- Set `readTimeoutMillis` to match your maximum acceptable API response time. For example, if your SLA requires failing fast on slow downstream calls, use a lower value (e.g. 10-15 seconds).
364
+
- Keep `connectionTimeoutMillis` relatively low (e.g. 5-15 seconds) since a healthy server should accept connections quickly.
365
+
366
+
~~~~java
367
+
// Example: Configure timeouts via Config object
368
+
Config config =newConfig()
369
+
.environment(Environment.LIVE)
370
+
.liveEndpointUrlPrefix("myCompany")
371
+
.apiKey("YOUR_API_KEY")
372
+
.connectionTimeoutMillis(10000) // 10 sec to establish connection
373
+
.readTimeoutMillis(15000) // 15 sec max to receive a response
374
+
.connectionRequestTimeoutMillis(5000); // 5 sec to acquire a pooled connection
375
+
376
+
Client client =newClient(config);
377
+
378
+
// Or use the convenience method on the Client object
0 commit comments