Skip to content

Commit 8b10f84

Browse files
committed
Docs: Explain closing the high level client
It looks like we weren't clear on when and why you should close the high level client and folks were closing it after every request which is not efficient. This explains why you should close the client and when so this shouldn't be as common. Closes #32001
1 parent de476d5 commit 8b10f84

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

docs/java-rest/high-level/getting-started.asciidoc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,11 @@ include-tagged::{doc-tests}/MainDocumentationIT.java[rest-high-level-client-init
127127
--------------------------------------------------
128128

129129
The high-level client will internally create the low-level client used to
130-
perform requests based on the provided builder, and manage its lifecycle.
131-
132-
The high-level client instance needs to be closed when no longer needed so that
133-
all the resources used by it get properly released, as well as the underlying
134-
http client instance and its threads. This can be done through the `close`
135-
method, which will close the internal `RestClient` instance.
130+
perform requests based on the provided builder. That low-level client
131+
maintains a pool of connections and starts some threads so you should
132+
close the high-level client when you are well and truly done with
133+
it and it will in turn close the internal low-level client to free those
134+
resources. This can be done through the `close`:
136135

137136
["source","java",subs="attributes,callouts,macros"]
138137
--------------------------------------------------

0 commit comments

Comments
 (0)