-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在多任务下载时遇到一个问题 #383
Comments
我调试后,发现tasks中的任务是有监听的,我不知道为什么queueSet.downloadTogether(tasks).start再次启动却提示这个。还是说FileDownloadQueueSet 不支持动态添加任务呢 |
|
public synchronized void start(final DownloadInfo downloadInfo) 方法2的话,难道每次暂停啊、继续什么的,都需要重新生成Task吗,那这样也太不好了吧。
|
而且我发现监听中的#completed方法走了多次,不过是概率性的问题,次数而且是不固定的。反正机率很大,特别是在不停的切换页面的时候很容易出现。 |
内部代码逻辑这块是不允许的。 定位你看看 |
… task instances before start them Ref #383
…ovided listener when the user try to start tasks with the listener Closes #383
我使用这种方式启动下载。
final FileDownloadQueueSet queueSet = new FileDownloadQueueSet(downloadListener);
final List tasks = new ArrayList<>();
for (int i = 0; i < count; i++) {
tasks.add(FileDownloader.getImpl().create(Constant.URLS[i]).setTag(i + 1));
}
queueSet.downloadTogether(tasks);
但是我的任务并不是一起的加入的,而是根据点击一个个的添加的任务。同时呢有多个页面切换,但下载地址是不会变的,这个时候按理说任务是不变,界面只需要做刷新即可。但当暂停后再次使用queueSet.downloadTogether(tasks).start来启动任务,就会出现“FileDownloader.FileDownloader: Tasks with the listener can't start, because can't find any task with the provided listener”,意思是我没有提供监听。而监听呢是在最开始的时候已经设置了“new FileDownloadQueueSet(downloadListener);”并不需要再次设置吧?所以并不清楚正确的启动方式是怎样的?还是说遍历tasks,再去启动任务吗?
The text was updated successfully, but these errors were encountered: