Threading question

  • Thread starter Thread starter Steve B.
  • Start date Start date
S

Steve B.

Hello

I have a job that consist in calling up to 10000 a WebService using a
different parameter each time.

I wonder if using thread could help me to speed up the whole process, since
I suspect http to slow the rest of the application.

If yes, how can I split each 10000 jobs to be ran into 10 threads?
I was not able to have a "Wait for all 10 threads to be finished"

Thanks
 
that seems like a lot - is this one of those spam mailing campains???

but anyway, you can stack the jobs in an arraylist and divide it evenly
among the 10 threads. pick a random thread to get the extra which may not
exceed 9 btw. so one thread will tend to have slightly more work to do
depending on the evenness of the count. fire your threads. if you need a
return value, have you thread return a parameter to the calling routine
 
Don't worry I'm not one of this *** spammers :)

I actually need to call the webservice to get pdf files to store it in a
\\server\share.

I'll tr your solution, thanks,

Steve

Alvin Bruney said:
that seems like a lot - is this one of those spam mailing campains???

but anyway, you can stack the jobs in an arraylist and divide it evenly
among the 10 threads. pick a random thread to get the extra which may not
exceed 9 btw. so one thread will tend to have slightly more work to do
depending on the evenness of the count. fire your threads. if you need a
return value, have you thread return a parameter to the calling routine

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Steve B. said:
Hello

I have a job that consist in calling up to 10000 a WebService using a
different parameter each time.

I wonder if using thread could help me to speed up the whole process,
since
I suspect http to slow the rest of the application.

If yes, how can I split each 10000 jobs to be ran into 10 threads?
I was not able to have a "Wait for all 10 threads to be finished"

Thanks
 
Back
Top