diff --git a/Parse/src/main/java/com/parse/ParseRequest.java b/Parse/src/main/java/com/parse/ParseRequest.java index 0579662a8..767dae25f 100644 --- a/Parse/src/main/java/com/parse/ParseRequest.java +++ b/Parse/src/main/java/com/parse/ParseRequest.java @@ -62,7 +62,12 @@ private static ThreadPoolExecutor newThreadPoolExecutor(int corePoolSize, int ma return executor; } - /* package */ static final ExecutorService NETWORK_EXECUTOR = newThreadPoolExecutor( + /** + * This executor should be used for any network operation, in all subclasses. + * Chaining network operations with tasks consumed by Task.BACKGROUND_EXECUTOR , which is smaller, + * will cause performance bottlenecks and possibly lock the whole SDK. + */ + protected static final ExecutorService NETWORK_EXECUTOR = newThreadPoolExecutor( CORE_POOL_SIZE, MAX_POOL_SIZE, KEEP_ALIVE_TIME, TimeUnit.SECONDS, new LinkedBlockingQueue(MAX_QUEUE_SIZE), sThreadFactory); @@ -147,7 +152,7 @@ public Task then(Task task) throws Exception { } return task; } - }, Task.BACKGROUND_EXECUTOR); + }, NETWORK_EXECUTOR); } protected abstract Task onResponseAsync(ParseHttpResponse response,