Skip to content

Commit 8e6b575

Browse files
author
Oriental Sensation
committed
Enable custom classes to override the default threading behavior.
1 parent 1f9a340 commit 8e6b575

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

library/src/main/java/com/loopj/android/http/AsyncHttpClient.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public AsyncHttpClient(SchemeRegistry schemeRegistry) {
217217

218218
ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(httpParams, schemeRegistry);
219219

220-
threadPool = Executors.newCachedThreadPool();
220+
threadPool = getDefaultThreadPool();
221221
requestMap = new WeakHashMap();
222222
clientHeaderMap = new HashMap();
223223

@@ -348,6 +348,15 @@ public ExecutorService getThreadPool() {
348348
return threadPool;
349349
}
350350

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+
351360
/**
352361
* Simple interface method, to enable or disable redirects. If you set manually RedirectHandler
353362
* on underlying HttpClient, effects of this method will be canceled.

0 commit comments

Comments
 (0)