We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
I'm not sure what 'n' and 'it' are in your comment. Perhaps if you asked one question at a time, it'd be easier for you to explain and for me to answer.
So, if a parent is triggered on a notification from child, it doesn't until all the childs finish. So you are using a set to check if all my dependencies are met, if a parent is having a high degree of vertices, that check may cause a lot of time
This looks like a truly elegant solution to the problem. One question I had is why the Task.addDependent method contains the line:
dependsOn.add(this);
It appears that this creates a circular dependency of a task -> dependentTask -> task. I must be misunderstanding the intent of that part of the code.
Thanks again for the great article.
Hi Baron,
The line of code you referred to doesn't create a circular dependency, it adds a dependency to itself. It's been a while I wrote this article, and unfortunately I don't remember why I had done that. The best way for you would be to take the code snippets shown above, complete and execute it; you can then see for yourself the effects with and without that line.
If you happen to do that, feel free to comment here what you find.
It seems that if their dependencies have been met, it would take O(n) time. would this be expensive everytime it gets an event change? Have you thought about keeping some kind of latch to ensure its decremented or comparing the size of the set. Also is this property change events executed one after the other