Use try-with-resources in examples

This commit is contained in:
Oleg Kalnichevski 2020-02-24 12:07:55 +01:00
parent f4fb8b5e1d
commit 56ef8b8642
1 changed files with 1 additions and 4 deletions

View File

@ -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();
}
}