mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-02-06 01:59:10 +00:00
Use try-with-resources in examples
This commit is contained in:
parent
f4fb8b5e1d
commit
56ef8b8642
@ -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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user