maybe someone could recommend some good examples concerning thread executions, thread management. Maybe not only examples but article, tutorial if you will with examples.
Generally I have a problem where I need to download a bunch of files from the web, but connection is limited to two. So when I gather up all the url’s to files I need, I’d like to download say… 100 files but do so in async manner by two until all the threads finish their job.
Thank, you for support.
Use an
ExecutorServicethat uses a fixed thread pool of size 2, and submit all the tasks to thatExecutorService.