07-25-2010 11:56 PM
I've looked around the forums and haven't found the best way to do what I'm interested in. I'm writing an application that requires downloading multiple images and then composing them on top of each other to produce the final image. I'm wondering if the best way to do this is to open multiple connection threads and then try to .join() all of them all at the end, or if I should open and close each connection serialy, one after another? None of the files are appreciably larger than the others, so each one should take approximately the same time to download.
07-26-2010 01:37 AM
Usually I'd go with the simplest approach - download images one after another.
The only advantage to use parallel download is if you are working with large data sets and you believe that parallel download will improve the speed. (Which I do not think is the case).
Note - for each image download, start a I/O thread PLUS some tracking mechanism (TimerTask or another thread). If there is no data coming for 10-15 seconds, you should kill the connection and start again.