Skip to content

Commit 86971b1

Browse files
committed
Address review feedback
1 parent 339f6b4 commit 86971b1

File tree

1 file changed

+6
-7
lines changed
  • docs/reference/transport/rest5-client/config

1 file changed

+6
-7
lines changed

docs/reference/transport/rest5-client/config/timeouts.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@
33
You can set timeouts when building the `Rest5Client`:
44

55
- The **connect timeout** is the maximum time for establishing a TCP connection, including the TLS handshake. The connect timeout is set on `ConnectionConfig`.
6+
- The **socket timeout** is the maximum idle time waiting for I/O on an established socket. The socket timeout is set on `ConnectionConfig`.
67
- The **response timeout** is the maximum period to wait for response data. The response timeout is set on `RequestConfig`.
78
- The **connection request timeout** is the maximum time for leasing a connection from the pool. The connection request timeout is set on `RequestConfig`.
89

9-
To configure timeouts, use `setHttpClientConfigCallback` and `setRequestConfigCallback` while building the `Rest5Client`. The following example sets a 10-second connect timeout and a 20-second response timeout:
10+
To configure timeouts, use `setConnectionConfigCallback` and `setRequestConfigCallback` while building the `Rest5Client`. The following example sets a 10-second connect timeout, a 10-second socket timeout, and a 20-second response timeout:
1011

1112
% :::{include-code} src={{doc-tests-src}}/rest5_client/RestClientDocumentation.java tag=rest-client-config-timeouts
1213
```java
1314
Rest5ClientBuilder builder = Rest5Client
14-
.builder(new HttpHost("localhost", 9200, "http")) <1>
15-
.setHttpClientConfigCallback(c -> c.setDefaultConnectionConfig(
16-
ConnectionConfig.custom()
17-
.setConnectTimeout(Timeout.ofSeconds(10))
18-
.build()
19-
))
15+
.builder(new HttpHost("http", "localhost", 9200)) <1>
16+
.setConnectionConfigCallback(connectConf -> connectConf
17+
.setConnectTimeout(Timeout.ofSeconds(10))
18+
.setSocketTimeout(Timeout.ofSeconds(10)))
2019
.setRequestConfigCallback(r -> r
2120
.setResponseTimeout(Timeout.ofSeconds(20))
2221
);

0 commit comments

Comments
 (0)