From 1cfe9917c73807757ec9c51d1ab9341295892bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sautter?= Date: Mon, 4 Mar 2024 17:16:00 +0100 Subject: [PATCH] [java] close the httpclient after checking the service status #13643 --- .../openqa/selenium/grid/node/relay/RelaySessionFactory.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/java/src/org/openqa/selenium/grid/node/relay/RelaySessionFactory.java b/java/src/org/openqa/selenium/grid/node/relay/RelaySessionFactory.java index f812b7e8b3dc7..4312b6b379dc4 100644 --- a/java/src/org/openqa/selenium/grid/node/relay/RelaySessionFactory.java +++ b/java/src/org/openqa/selenium/grid/node/relay/RelaySessionFactory.java @@ -209,8 +209,7 @@ public boolean isServiceUp() { // If no status endpoint was configured, we assume the server is up. return true; } - try { - HttpClient client = clientFactory.createClient(serviceStatusUrl); + try (HttpClient client = clientFactory.createClient(serviceStatusUrl)) { HttpResponse response = client.execute(new HttpRequest(HttpMethod.GET, serviceStatusUrl.toString())); LOG.log(Debug.getDebugLogLevel(), () -> Contents.string(response));