|
69 | 69 | import java.util.List;
|
70 | 70 | import java.util.Map;
|
71 | 71 | import java.util.WeakHashMap;
|
| 72 | +import java.util.concurrent.ExecutorService; |
72 | 73 | import java.util.concurrent.Executors;
|
73 | 74 | import java.util.concurrent.Future;
|
74 | 75 | import java.util.concurrent.ThreadPoolExecutor;
|
@@ -107,7 +108,7 @@ public class AsyncHttpClient {
|
107 | 108 |
|
108 | 109 | private final DefaultHttpClient httpClient;
|
109 | 110 | private final HttpContext httpContext;
|
110 |
| - private ThreadPoolExecutor threadPool; |
| 111 | + private ExecutorService threadPool; |
111 | 112 | private final Map<Context, List<WeakReference<Future<?>>>> requestMap;
|
112 | 113 | private final Map<String, String> clientHeaderMap;
|
113 | 114 | private boolean isUrlEncodingEnabled = true;
|
@@ -209,7 +210,7 @@ public AsyncHttpClient(SchemeRegistry schemeRegistry) {
|
209 | 210 |
|
210 | 211 | ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(httpParams, schemeRegistry);
|
211 | 212 |
|
212 |
| - threadPool = (ThreadPoolExecutor) Executors.newFixedThreadPool(DEFAULT_MAX_CONNECTIONS); |
| 213 | + threadPool = Executors.newFixedThreadPool(DEFAULT_MAX_CONNECTIONS); |
213 | 214 | requestMap = new WeakHashMap<Context, List<WeakReference<Future<?>>>>();
|
214 | 215 | clientHeaderMap = new HashMap<String, String>();
|
215 | 216 |
|
@@ -337,7 +338,6 @@ public void setMaxConnections(int maxConnections) {
|
337 | 338 | this.maxConnections = maxConnections;
|
338 | 339 | final HttpParams httpParams = this.httpClient.getParams();
|
339 | 340 | ConnManagerParams.setMaxConnectionsPerRoute(httpParams, new ConnPerRouteBean(this.maxConnections));
|
340 |
| - this.threadPool.setCorePoolSize(maxConnections); |
341 | 341 | }
|
342 | 342 |
|
343 | 343 | /**
|
|
0 commit comments