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

View File

@ -49,8 +49,7 @@
public class AsyncQuickStart { public class AsyncQuickStart {
public static void main (final String[] args) throws Exception { public static void main (final String[] args) throws Exception {
final CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault(); try (final CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault()) {
try {
// Start the client // Start the client
httpclient.start(); httpclient.start();
@ -143,8 +142,6 @@ public void cancelled() {
}); });
latch2.await(); latch2.await();
} finally {
httpclient.close();
} }
} }