File tree 1 file changed +20
-1
lines changed
library/src/main/java/com/loopj/android/http
1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -217,7 +217,7 @@ public AsyncHttpClient(SchemeRegistry schemeRegistry) {
217
217
218
218
ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager (httpParams , schemeRegistry );
219
219
220
- threadPool = Executors . newCachedThreadPool ();
220
+ threadPool = getDefaultThreadPool ();
221
221
requestMap = new WeakHashMap ();
222
222
clientHeaderMap = new HashMap ();
223
223
@@ -338,6 +338,25 @@ public void setThreadPool(ThreadPoolExecutor threadPool) {
338
338
this .threadPool = threadPool ;
339
339
}
340
340
341
+ /**
342
+ * Returns the current executor service used. By default,
343
+ * Executors.newFixedThreadPool() is used.
344
+ *
345
+ * @return current executor service used
346
+ */
347
+ public ExecutorService getThreadPool () {
348
+ return threadPool ;
349
+ }
350
+
351
+ /**
352
+ * Get the default threading pool to be used for this HTTP client.
353
+ *
354
+ * @return The default threading pool to be used
355
+ */
356
+ protected ExecutorService getDefaultThreadPool () {
357
+ return Executors .newCachedThreadPool ();
358
+ }
359
+
341
360
/**
342
361
* Simple interface method, to enable or disable redirects. If you set manually RedirectHandler
343
362
* on underlying HttpClient, effects of this method will be canceled.
You can’t perform that action at this time.
0 commit comments