vendredi 24 juillet 2015

Design solution for working with multiple instantiations at the same time

I don't know if my title is correct. But here's what I want to know.

I have a Downloader class that returns certain events and has a couple of methods. Each instance of Downloader class can download a single file. And all those events and methods are related to the file being downloaded.

As it's a multi file downloader, multiple instantiations are required when more than a single file needs to be downloaded.

Each download has a download id, but that is not supplied to the downloader class, to keep it independent from the other classes.

Now getting all the info from each instance of the file download and being able to control a single download, is the problem. How do I know which download is which?

Any solutions? Or design patterns you could recommend? I've hit a roadblock.

Aucun commentaire:

Enregistrer un commentaire