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. AudioRecord is not working on emulator

Hi All,

I used AudioRecord on emulator and phone. I found that AudioRecord is
not working on phone:
1> the min-buffer-size on simulator is much smaller than phone
2> The audio data I read from phone is all zero.

Does anyone has same experience?

Thanks!

Cindy

-- 

2. Why might the soft keyboard not pop up?

I have an EditText control that does not pop up the soft keyboard when
the user touches it.  The thing is, that I have a number of other
EditText controls elsewhere in my application that all work fine, and
I cannot see anything really different about this one.  The code is a
bit complex to post here, but I was wondering if anyone knows of any
reasons why the soft keyboard would not appear in some cases.

Thanks

-- 

3. Full Screen Caller Pictures and Full Screen Caller ID

4. implementing custom system calls

5. Multiple Certificates and Upgrade proces

6. custom view onDraw() in layout xml not called

7. small question abt intent