File tree 1 file changed +11
-4
lines changed
src/main/java/com/ning/http/client 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 30
30
import java .io .InputStream ;
31
31
import java .util .Collection ;
32
32
import java .util .Map ;
33
+ import java .util .concurrent .ExecutorService ;
34
+ import java .util .concurrent .Executors ;
33
35
import java .util .concurrent .Future ;
34
36
import java .util .concurrent .atomic .AtomicBoolean ;
35
37
@@ -370,11 +372,16 @@ public void close() {
370
372
* Asynchronous close the {@link AsyncHttpProvider} by spawning a thread and avoid blocking.
371
373
*/
372
374
public void closeAsynchronously () {
373
- config . applicationThreadPool . submit ( new Runnable () {
374
-
375
+ final ExecutorService e = Executors . newSingleThreadExecutor ();
376
+ e . submit ( new Runnable () {
375
377
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
+ }
378
385
}
379
386
});
380
387
}
You can’t perform that action at this time.
0 commit comments