In my project, I need to perform multiple HTTP requests with a single AndroidHttpClient instance but actually, HTTP requests are processed one by one. There is a way to define a maximum number of concurrent connections?
HTTP requests are executed in parallel, but if you are using AsyncTask
then the tasks themselves are by default executed serially, one at a time. To change this behavior, use executeOnExecutor
method to run them in parallel:
new MyAsyncTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, ...);
That should resolve this problem.