You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2020/03/07 10:12:10 UTC
[httpcomponents-client] 01/03: Use try-with-resources in examples
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
commit 56ef8b8642ab334cd0b35144c374295150af2bb2
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Mon Feb 24 12:07:55 2020 +0100
Use try-with-resources in examples
---
.../java/org/apache/hc/client5/http/examples/AsyncQuickStart.java | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncQuickStart.java b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncQuickStart.java
index e237a58..1d7d4fe 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncQuickStart.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncQuickStart.java
@@ -49,8 +49,7 @@ import org.apache.hc.core5.http.nio.support.AsyncRequestBuilder;
public class AsyncQuickStart {
public static void main (final String[] args) throws Exception {
- final CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault();
- try {
+ try (final CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault()) {
// Start the client
httpclient.start();
@@ -143,8 +142,6 @@ public class AsyncQuickStart {
});
latch2.await();
- } finally {
- httpclient.close();
}
}