The requirement is to upload max 40 images to the server, currently i am able to upload all the 40 images(with some data specific to that image)on to the server. Now I have to upload all the 40 Images in parallel(previously done sequentially).
for(int i=0;i<imageList.size();i++){
MyAsync async = new MyAsync(imageList.get(i));
async.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
The above code is the demo for what I did in my project. ImageList is the list of images which is I am passing to the AsyncTask to upload that Image.
Now at a time there is 9 parallel doInBackground() is called(added log to see).
when upload starts in doInBackground() method, I am using call.execute() to upload on Current Thread instead of call.enqueue().
The problem is, if there are 40 images to upload then only 5 to 6 images is uploading, I am uploading the original image with Multipart, so there is no wrong in uploading, infact sequential uploading is working fine.
The only problem is when trying to upload parallel way.
Can anybody please give me some suggestion to solve this kind of issue???
Any help is Appreciated.
Thanks in advance.