I'm writing a multi-threaded app in which multiple threads will use
HttpClient to send client requests.  In my situation, it's possible a
request might be outstanding for a very long time as my server might
take as long as several minutes before responding.  (Don't ask.)

My problem: If my app needs to shut down, how can my main thread
cleanly shut down one of the threads blocked on an outstanding
request?

Specifically: I see that the HttpConnection:shutdown() looks exactly
like what I need, but I haven't been able to figure out how to expose
the HttpConnection object associated with an HttpClient request.

The best I can come up with is using
ThreadSafeClientConnManager:requestConnection() to first fetch an
HttpClientConnection object and then using HttpRequestExecutor:execute
(passing in the HttpRequest and HttpClientConnection), but that seems
a bit clunky and I was hoping there was a cleaner way.

Any suggestions?

As a follow-on question, could I use
ThreadSafeClientConnManager:shutdown() from the main thread to shut
down any outstanding HTTP requests in other threads?

Thanks.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to