You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Håkon Sagehaug <ha...@uni.no> on 2010/11/30 11:22:51 UTC

Multithreaded http downloads

Hi all,

I've got a service that users can use to download files from a http. I want
to add functionality so that a user can supply many urls and the service
starts to download the files. So I wondered if the way described here[1] is
the corrects approach, section about Multithreaded request execution

Cheers, håkon

[1]
http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d4e629

RE: Multithreaded http downloads

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2010-12-01 at 12:55 +0100, Roman Kennke wrote:
> Hi,
> 
> >> I've got a service that users can use to download files from a http. I want
> >> to add functionality so that a user can supply many urls and the service
> >> starts to download the files. So I wondered if the way described here[1] is
> >> the corrects approach, section about Multithreaded request execution
> >> 
> >> Cheers, håkon
> >> 
> >
> >Yes, it is.
> 
> Am I correct that BasicHttpContext must not be shared between threads? Would it be ok to share SyncBasicHttpContext? Or does it never make sense to share the context?
> 

Generally each execution thread should have a local HttpContext
instance. Sharing the same execution context between multiple threads
does not really make sense and may cause issues with some protocol
interceptors. Though, one may share some objections between multiple
contexts such as cookie store or auth credentials provider.

Hope this helps

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


RE: Multithreaded http downloads

Posted by Roman Kennke <ro...@jpmchase.com>.
Hi,

>> I've got a service that users can use to download files from a http. I want
>> to add functionality so that a user can supply many urls and the service
>> starts to download the files. So I wondered if the way described here[1] is
>> the corrects approach, section about Multithreaded request execution
>> 
>> Cheers, håkon
>> 
>
>Yes, it is.

Am I correct that BasicHttpContext must not be shared between threads? Would it be ok to share SyncBasicHttpContext? Or does it never make sense to share the context?


Regards, Roman


This communication is for informational purposes only. It is not
intended as an offer or solicitation for the purchase or sale of
any financial instrument or as an official confirmation of any
transaction. All market prices, data and other information are not
warranted as to completeness or accuracy and are subject to change
without notice. Any comments or statements made herein do not
necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.

Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to European legal entities.

Re: Multithreaded http downloads

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2010-11-30 at 11:22 +0100, Håkon Sagehaug wrote:
> Hi all,
> 
> I've got a service that users can use to download files from a http. I want
> to add functionality so that a user can supply many urls and the service
> starts to download the files. So I wondered if the way described here[1] is
> the corrects approach, section about Multithreaded request execution
> 
> Cheers, håkon
> 

Yes, it is.

Oleg

> [1]
> http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d4e629



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org