Skip to content

Commit f9f9cf4

Browse files
author
Stephane Landelle
committed
Make closeAsynchronously shutdown own thread, close AsyncHttpClient#458
1 parent 321f3c0 commit f9f9cf4

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/main/java/com/ning/http/client/AsyncHttpClient.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -375,17 +375,21 @@ public void close() {
375375
*/
376376
public void closeAsynchronously() {
377377
final ExecutorService e = Executors.newSingleThreadExecutor();
378-
e.submit(new Runnable() {
379-
public void run() {
380-
try {
381-
close();
382-
} catch (Throwable t) {
383-
logger.warn("", t);
384-
} finally {
385-
e.shutdown();
378+
try {
379+
e.submit(new Runnable() {
380+
public void run() {
381+
try {
382+
close();
383+
} catch (Throwable t) {
384+
logger.warn("", t);
385+
} finally {
386+
e.shutdown();
387+
}
386388
}
387-
}
388-
});
389+
});
390+
} finally {
391+
e.shutdown();
392+
}
389393
}
390394

391395
@Override

0 commit comments

Comments
 (0)