Skip to content

Commit d371dd9

Browse files
committed
Fix for AsyncHttpClient#85 AsyncHttpClient should allow asynchronous close operation
1 parent a0e30d8 commit d371dd9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,19 @@ public void close() {
365365
isClosed.set(true);
366366
}
367367

368+
/**
369+
* Asynchronous close the {@link AsyncHttpProvider} by spawning a thread and avoid blocking.
370+
*/
371+
public void closeAsynchronously() {
372+
config.applicationThreadPool.submit(new Runnable() {
373+
374+
public void run() {
375+
httpProvider.close();
376+
isClosed.set(true);
377+
}
378+
});
379+
}
380+
368381
@Override
369382
protected void finalize() throws Throwable {
370383
try {

0 commit comments

Comments
 (0)