在后台上传过程中访问其他 http 响应的问题

Issue for access the other http response during the upload progress in Background

我正在通过使用 Apache 库通过多部分实体生成器在服务器上上传多个文件来上传一些文件。它完美上传。但与此同时,当我在上传过程中访问其他 http 请求时,服务器会阻止我的所有其他 http 请求,一旦上传完成,然后在给我其他 http 响应之后。我不明白哪里错了? 请建议我解决这个问题。

这里我使用的是上传代码:

@Override
            protected String doInBackground(String... urls) {
                String response1 = "";


                Prefs = context.getSharedPreferences(prefname, Context.MODE_PRIVATE);
                String memberid=Prefs.getString(ImageConstant.MEMBERID, "");

                try {

                       String url=ImageConstant.BASEURL+"image_fileupload.php";
                       Log.v(TAG, "url is: "+url);
                       HttpClient client = new DefaultHttpClient();
                        HttpPost post = new HttpPost(url);
                        MultipartEntityBuilder builder = MultipartEntityBuilder.create();        
                        builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);


                        for (int i = 1; i <= dataT.size(); i++) {
                            CustomGallery gallery=dataT.get(i-1);
                            String filename=gallery.sdcardPath;
                            Log.v(TAG, "file name: "+filename);

                            File file = new File(filename);
                            FileBody fb = new FileBody(file);
                            builder.addPart("file"+i, fb);



                        }



                        builder.addTextBody("member_id", memberid);
                        builder.addTextBody("count", String.valueOf(dataT.size()));

                        final HttpEntity yourEntity = builder.build();

                        CustomMultiPartEntity entity=new CustomMultiPartEntity(yourEntity, new ProgressListener() {

                            @Override
                            public void transferred(long num) {

                                publishProgress((int) ((num / (float) totalsizeimage) * 100));
                                //Log.v(TAG, "publish progress :"+totalsizeimage);
                                 ImageUtil.galleryLog(TAG, "publish progress :"+totalsizeimage);
                            }


                        });
                        totalsizeimage = entity.getContentLength();
                       // Log.v(TAG, "total size is: "+totalsize);
                        ImageUtil.galleryLog(TAG, "total size is: "+totalsize);
                        post.setEntity(entity);
                        HttpResponse response = client.execute(post);        
                        response1= getContent(response);

                    // response=postFile(dataT, memberid);

                    Log.v(TAG, "response is: "+ response1);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
             return response1;
        }

使用 THREAD_POOL_EXECUTOR

执行您的异步任务
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);