download-manager icon indicating copy to clipboard operation
download-manager copied to clipboard

Prioritization download requests (enhancement idea)

Open Konrad-Morawski opened this issue 4 years ago • 0 comments

A feature the library currently doesn't provide is prioritization of queued downloads. I have encountered a real-life usecase for it, whereby a client app is supposed to distinguish between auto-initiated and user-initiated downloads, considering the latter (understandably) to be of higher priority. What are you thoughts, or plans, on such a feature?

From what I see, the library is unopinionated on the subject of queuing downloads. It works strictly on a first come, first served basis.

It's also closed in this regard, I mean its API doesn't offer any possibility of overriding this behavior (that I could find).

One way of achieving this that I can think of would be to wrap the Executor (initialized in the DownloadManagerBuilder and currently hardcoded as Executors.newSingleThreadExecutor()) in some abstraction. This "ExecutorWrapper" would get to "see" the details of the incoming download requests, and be able to determine their priority. Consumers of a library could override the default implementation with a custom one, wrapped over a more sophisticated Executor.

Obviously it would be entirely optional, as such feature isn't needed in typical case. I wonder what your thoughts on the matter are.

Konrad-Morawski avatar Dec 30 '19 12:12 Konrad-Morawski