Hi ! So I can do something similar like here (http://hc.apache.org/httpcomponents-client-4.3.x/httpclient/examples/org/apache/http/examples/client/ClientMultiThreadedExecution.java) using ExecutorService than "normal" threads (just need to use the PoolingHttpClientConnectionManager) ?
yours Arnold On Mon, Oct 13, 2014 at 3:50 PM, Oleg Kalnichevski <[email protected]> wrote: > On Mon, 2014-10-13 at 11:59 +0200, Arnold Maderthaner wrote: >> Hi ! >> >> I'm trying to write a simple application that does a multi threaded >> HTTP Get download from a server which needs to download approx. 2000 >> files. >> I have a list of URLs that I want to fetch and want the binary content >> to be stored either on the filesystem or in memory. >> Depending on configuration I want to use 10 threads to download this >> from the server. >> >> What is the best method to implement this ? Should I use an >> ExecutorService with a fixed thread pool and create an own HTTPClient >> for each thread or is there some better (less expensive) approach ? >> > > You should be using multiple worker threads (by means of ExecutorService > or otherwise) but make worker threads share the same instance of > HttpClient. > > Oleg > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
