AsyncTask and simultaneous network downloads

by Jason Proctor » Fri, 29 Jan 2010 05:02:26 GMT


Sponsored Links
 i hope not, because the code makes a new HttpClient instance per 
ArtRetrievalTask. i suppose it could be trying to be clever, 
realising that the requests are going to the same place, and 
utilising HTTP 1.1 to bundle the requests into the same connection.


if that's really what's happening (and i suspect not, somehow), and 
maybe only the server logs can tell for sure, then i hereby state for 
the 67th time how happy i am that i dumped HttpClient and rolled my 
own HTTP.



Perhaps the requests are being serialized by HttpClient? I wonder if there's a way to determine the actual thread a particular AsyncTask's doInBacground process runs on, like maybe a thread id? --



AsyncTask and simultaneous network downloads

by Jason Proctor » Fri, 29 Jan 2010 05:29:21 GMT


 the main HttpClient showstopper for me was its buggy cookie 
implementation - i needed to share cookies between WebKit and 
HttpClient, and HttpClient wouldn't play nice. however, i also 
thought the API was awkward to use. last thing, i took a look at the 
code. someone really managed to turn something relatively simple into 
a gothic monstrosity.


so i wrote my own (simple) HTTP implementation on top of 
java.net.Socket. it's very simple and doesn't support any fruity 
options, but it integrates with my progress reporting system, and 
automatically shares cookies with WebKit. it has a pluggable content 
handler system so you can easily get binary, JSON, strings, etc, from 
resources with one line of code.


my apps now depend on it -- i use it from within AsyncTasks all the 
damn time and it's solid.




Jason, Rolled your own? Can you share/elaborate? There seems to be other issues with HttpClient. I am looking at either integrating Jersey/JAX-B client side to send REST calls (my server side is all Jersey/JEE6/JAXB based), but if that is too bulky for the app, then I was looking at using URLConnection.. but I haven't tried using that for REST calls with Basic Auth, various headers, xml/json body, etc. On Thu, Jan 28, 2010 at 1:01 PM, Jason Proctor <<mailto:jason.android.li...@gmail.com>jason.android.li...@gmail.com> i hope not, because the code makes a new HttpClient instance per ArtRetrievalTask. i suppose it could be trying to be clever, realising that the requests are going to the same place, and utilising HTTP 1.1 to bundle the requests into the same connection. if that's really what's happening (and i suspect not, somehow), and maybe only the server logs can tell for sure, then i hereby state for the 67th time how happy i am that i dumped HttpClient and rolled my own HTTP. Perhaps the requests are being serialized by HttpClient? I wonder if there's a way to determine the actual thread a particular AsyncTask's doInBacground process runs on, like maybe a thread id? --


Sponsored Links


AsyncTask and simultaneous network downloads

by Jason Proctor » Fri, 29 Jan 2010 05:46:41 GMT


 it belongs to my employer, so i can't. i would rewrite it at home and 
share it, but really i'd rather work on music at home.


just take a day and do it yourself. it's not so bad. and you'll thank 
yourself every day like i do :-)





Awesome.. share the code. :) On Thu, Jan 28, 2010 at 1:28 PM, Jason Proctor <<mailto:jason.android.li...@gmail.com>jason.android.li...@gmail.com> the main HttpClient showstopper for me was its buggy cookie implementation - i needed to share cookies between WebKit and HttpClient, and HttpClient wouldn't play nice. however, i also thought the API was awkward to use. last thing, i took a look at the code. someone really managed to turn something relatively simple into a gothic monstrosity. so i wrote my own (simple) HTTP implementation on top of java.net.Socket. it's very simple and doesn't support any fruity options, but it integrates with my progress reporting system, and automatically shares cookies with WebKit. it has a pluggable content handler system so you can easily get binary, JSON, strings, etc, from resources with one line of code. my apps now depend on it -- i use it from within AsyncTasks all the damn time and it's solid. Jason, Rolled your own? Can you share/elaborate? There seems to be other issues with HttpClient. I am looking at either integrating Jersey/JAX-B client side to send REST calls (my server side is all Jersey/JEE6/JAXB based), but if that is too bulky for the app, then I was looking at using URLConnection.. but I haven't tried using that for REST calls with Basic Auth, various headers, xml/json body, etc. On Thu, Jan 28, 2010 at 1:01 PM, Jason Proctor <<mailto:<mailto:jason.android.li...@gmail.com>jason.android.li...@gmail.com><mailto:jason.android.li...@gmail.com>jason.android.li...@gmail.com> i hope not, because the code makes a new HttpClient instance per ArtRetrievalTask. i suppose it could be trying to be clever, realising that the requests are going to the same place, and utilising HTTP 1.1 to bundle the requests into the same connection. if that's really what's happening (and i suspect not, somehow), and maybe only the server logs can tell for sure, then i hereby state for the 67th time how happy i am that i dumped HttpClient and rolled my own HTTP. Perhaps the requests are being serialized by HttpClient? I wonder if there's a way to determine the actual thread a particular AsyncTask's doInBacground process runs on, like maybe a thread id? --



Other Threads

1. Android on LG phone

Hello all,
Will it EVER in the future be possible to run Android on the LG enV2
I
currently own?
Thank you.

--~--~---------~--~----~------------~-------~--~----~

2. Form with background translucent or transparent, how???

Hi,
How to make the form background be translucent or transparent???
Anyone can help me???
have a nice day...

wesley.
--~--~---------~--~----~------------~-------~--~----~

3. Alert Dialog never displayed in when call in the run() method of a separate process.

4. Anyone needs android developers?

5. ADB Issues in Android 0.9 beta SDK

6. Winners Apps Source Code

7. Problem with sensors