Skip to content
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

InQueueTask not possible to utilize Tags #307

Closed
chriswiesner opened this issue Sep 6, 2016 · 7 comments
Closed

InQueueTask not possible to utilize Tags #307

chriswiesner opened this issue Sep 6, 2016 · 7 comments

Comments

@chriswiesner
Copy link

Am i right, that of version 1.0.0 a BaseDownloadTask which belongs to a FileDownloadQueueSet has to be created as asInQueueTask()?

Problem now, is that the interface does not expose the setTag() methods, which i would ned to set some meta-information to the task.

@Jacksgong
Copy link
Collaborator

Jacksgong commented Sep 6, 2016

NO, The operation of the new method asInQueueTsak() is the same to the old method BaseDownloadTask#ready().

If you use FileDownloadQueueSet, you don't need to change any code.

This change just wants someone use FileDownloader#start(listener, isSerial) directly to start a queue know the method only used in queue-task, if it is an isolated task, please don't invoke the method.

You also can check out this in Wiki: Start-downloading.

@chriswiesner
Copy link
Author

ok, was already confused about those code changes, as the changelog didn't state anything about that.

still i get an Exception when using 1.0.1 instead of 0.3.5.

java.lang.IllegalStateException: If you start the task manually, it means this task doesn't belong to a queue, so you must not invoke BaseDownloadTask#ready() or InQueueTask#enqueue() before you start() this method. For detail: If this task doesn't belong to a queue, what is just an isolated task, you just need to invoke BaseDownloadTask#start() to start this task, that's all. In other words, If this task doesn't belong to a queue, you must not invoke BaseDownloadTask#ready() method or InQueueTask#enqueue() method before invoke BaseDownloadTask#start(), If you do that and if there is the same listener object to start a queue in another thread, this task may be assembled by the queue, in that case, when you invoke BaseDownloadTask#start() manually to start this task or this task is started by the queue, there is an exception buried in there, because this task object is started two times without declare BaseDownloadTask#reuse() : 1. you invoke BaseDownloadTask#start() manually; 2. the queue start this task automatically.
at com.liulishuo.filedownloader.DownloadTask.start(DownloadTask.java:284)

note: i'm using process.non-separate=true

setting up queue like this:

List<BaseDownloadTask> downloadTasks = ...
...
downloadTasks.add(FileDownloader.getImpl().create(request.getUrl()).setPath(...))
...
queueSet.downloadTogether(downloadTasks);
queueSet.start();

@Jacksgong
Copy link
Collaborator

Jacksgong commented Sep 6, 2016

Cloud you give me your exception stack trace.

@Jacksgong
Copy link
Collaborator

I find a way to produce this problem, it will occur when the connection of the filedownloader service lost and re-connected, and re-start the waiting-list tasks.

I will fix this problem immediately and release the 1.0.2.

@Jacksgong Jacksgong added the bug label Sep 6, 2016
@Jacksgong Jacksgong modified the milestone: 1.0.2 Sep 6, 2016
@Jacksgong
Copy link
Collaborator

Thanks for your issue this.

Jacksgong added a commit that referenced this issue Sep 6, 2016
…sk() to declare no need to invoke this method when user use FileDownloadQueueSet

Refs #307
@Jacksgong
Copy link
Collaborator

@chriswiesner This problem has fixed in 1.0.2.

@chriswiesner
Copy link
Author

thanks for the quick response/fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants