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

Change ClumpSource/Fetcher to honour call order #92

Merged
merged 1 commit into from
May 25, 2015

Conversation

williamboxhall
Copy link
Contributor


private[getclump] final class ClumpFetcher[T, U](source: ClumpSource[T, U]) {

private[this] val fetches = MutableMap[T, Promise[Option[U]]]()
private[this] val fetches = mutable.LinkedHashMap[T, Promise[Option[U]]]()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain this change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, why do you need LinkedHashMap?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it retains insertion order. From the docs:

The iterator and all traversal methods of this class visit elements in the order they were inserted.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The map is used only as a temporary cache and we don't iterate over it. I can't see why the change is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do end up iterating over it, see changing in pendingFetches

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now, thanks for the clarification. :)

fwbrasil added a commit that referenced this pull request May 25, 2015
Change ClumpSource/Fetcher to honour call order
@fwbrasil fwbrasil merged commit a95cb09 into master May 25, 2015
@fwbrasil fwbrasil deleted the clumpsources-honour-order branch May 25, 2015 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants