File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
src/main/java/com/ning/http/client Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 3030import java .io .InputStream ;
3131import java .util .Collection ;
3232import java .util .Map ;
33+ import java .util .concurrent .ExecutorService ;
34+ import java .util .concurrent .Executors ;
3335import java .util .concurrent .Future ;
3436import java .util .concurrent .atomic .AtomicBoolean ;
3537
@@ -370,11 +372,16 @@ public void close() {
370372 * Asynchronous close the {@link AsyncHttpProvider} by spawning a thread and avoid blocking.
371373 */
372374 public void closeAsynchronously () {
373- config . applicationThreadPool . submit ( new Runnable () {
374-
375+ final ExecutorService e = Executors . newSingleThreadExecutor ();
376+ e . submit ( new Runnable () {
375377 public void run () {
376- httpProvider .close ();
377- isClosed .set (true );
378+ try {
379+ close ();
380+ } catch (Throwable t ) {
381+ logger .warn ("" , t );
382+ } finally {
383+ e .shutdown ();
384+ }
378385 }
379386 });
380387 }
You can’t perform that action at this time.
0 commit comments