From 8b10f84092b70d9568f0ec5af8bc52572750515c Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Thu, 12 Jul 2018 16:22:42 -0400 Subject: [PATCH] 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 --- docs/java-rest/high-level/getting-started.asciidoc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/java-rest/high-level/getting-started.asciidoc b/docs/java-rest/high-level/getting-started.asciidoc index 86fe473fb29e0..439f3a59d3a24 100644 --- a/docs/java-rest/high-level/getting-started.asciidoc +++ b/docs/java-rest/high-level/getting-started.asciidoc @@ -127,12 +127,11 @@ include-tagged::{doc-tests}/MainDocumentationIT.java[rest-high-level-client-init -------------------------------------------------- The high-level client will internally create the low-level client used to -perform requests based on the provided builder, and manage its lifecycle. - -The high-level client instance needs to be closed when no longer needed so that -all the resources used by it get properly released, as well as the underlying -http client instance and its threads. This can be done through the `close` -method, which will close the internal `RestClient` instance. +perform requests based on the provided builder. That low-level client +maintains a pool of connections and starts some threads so you should +close the high-level client when you are well and truly done with +it and it will in turn close the internal low-level client to free those +resources. This can be done through the `close`: ["source","java",subs="attributes,callouts,macros"] --------------------------------------------------